From 203967411a40080499b2f7b30aa6fbaf06c0eb43 Mon Sep 17 00:00:00 2001 From: DanS Date: Tue, 21 Jul 2026 14:12:44 -0500 Subject: [PATCH] feat(chat): theme the :drgx: emoji to the accent (was fixed brand colors) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The custom DragonX chat emoji now recolors to the theme like the logo — body = accent, detail = white on dark skins / on-surface (dark) on light skins — and re-rasterizes on a theme/dark-light change (moved out of the one-time fixed-color load into ensureLogoTexture's re-render block). The detail highlights keep it legible even on accent-tinted outgoing bubbles. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app.cpp | 14 +++++++------- src/app.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index c0f474d..06efcf9 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -1361,13 +1361,6 @@ void App::handleGlobalShortcuts() // theme accent, so it re-rasterizes whenever the accent or the dark↔light variant changes. void App::ensureLogoTexture() { - // DragonX custom chat emoji (":drgx:") — the mark in FIXED brand colors (crimson body + white detail), - // rasterized once. Kept theme-independent so it looks identical for the sender and the receiver. - if (!drgx_emoji_tex_) { - util::LoadTextureFromSvg(embedded::kLogoDragonXSvg, 96, IM_COL32(0xD8, 0x26, 0x52, 0xFF), - IM_COL32(255, 255, 255, 255), &drgx_emoji_tex_, &drgx_emoji_w_, &drgx_emoji_h_); - } - const bool wantDark = ui::material::IsDarkTheme(); const ImU32 logoAccent = ui::material::Primary(); if (logo_loaded_ && wantDark == logo_is_dark_variant_ && logoAccent == logo_accent_) @@ -1378,6 +1371,13 @@ void App::ensureLogoTexture() // The SVG's white highlight (detail) stays white on dark skins, but darkens to the theme's on-surface // colour on light skins so it doesn't wash out against a light card/background. const ImU32 detailCol = wantDark ? IM_COL32(255, 255, 255, 255) : ui::material::OnSurface(); + + // ":drgx:" custom chat emoji — themed to the accent like the logo (re-rasterized on theme change). + if (drgx_emoji_tex_) util::DestroyTexture(drgx_emoji_tex_); + drgx_emoji_tex_ = 0; drgx_emoji_w_ = 0; drgx_emoji_h_ = 0; + util::LoadTextureFromSvg(embedded::kLogoDragonXSvg, 96, logoAccent, detailCol, + &drgx_emoji_tex_, &drgx_emoji_w_, &drgx_emoji_h_); + if (logo_tex_) util::DestroyTexture(logo_tex_); // free the previous texture before replacing logo_tex_ = 0; logo_w_ = 0; logo_h_ = 0; diff --git a/src/app.h b/src/app.h index 2756a21..a762b8a 100644 --- a/src/app.h +++ b/src/app.h @@ -479,8 +479,8 @@ public: // Coin logo texture accessor (DragonX currency icon for balance tab) ImTextureID getCoinLogoTexture() const { return coin_logo_tex_; } - // DragonX custom chat emoji (the ":drgx:" shortcode) — the mark in fixed brand colors, lazily - // rasterized. Used by the emoji picker tile + inline in chat bubbles. + // DragonX custom chat emoji (the ":drgx:" shortcode) — the mark recolored to the theme accent (like + // the logo), re-rasterized on theme change. Used by the emoji picker tile + inline in chat bubbles. ImTextureID getDrgxEmojiTexture() const { return drgx_emoji_tex_; } /** @@ -1089,7 +1089,7 @@ private: bool logo_loaded_ = false; bool logo_is_dark_variant_ = true; // tracks which variant is currently loaded ImU32 logo_accent_ = 0; // theme accent the SVG logo was last rasterized with (re-render on change) - ImTextureID drgx_emoji_tex_ = 0; // ":drgx:" custom chat emoji (fixed brand colors) — rasterized once + ImTextureID drgx_emoji_tex_ = 0; // ":drgx:" custom chat emoji (themed to the accent, like the logo) int drgx_emoji_w_ = 0, drgx_emoji_h_ = 0; // Coin logo texture (DragonX currency icon, separate from wallet branding)