feat(chat): theme the :drgx: emoji to the accent (was fixed brand colors)
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) <noreply@anthropic.com>
This commit is contained in:
14
src/app.cpp
14
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.
|
// theme accent, so it re-rasterizes whenever the accent or the dark↔light variant changes.
|
||||||
void App::ensureLogoTexture()
|
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 bool wantDark = ui::material::IsDarkTheme();
|
||||||
const ImU32 logoAccent = ui::material::Primary();
|
const ImU32 logoAccent = ui::material::Primary();
|
||||||
if (logo_loaded_ && wantDark == logo_is_dark_variant_ && logoAccent == logo_accent_)
|
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
|
// 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.
|
// 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();
|
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
|
if (logo_tex_) util::DestroyTexture(logo_tex_); // free the previous texture before replacing
|
||||||
logo_tex_ = 0; logo_w_ = 0; logo_h_ = 0;
|
logo_tex_ = 0; logo_w_ = 0; logo_h_ = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -479,8 +479,8 @@ public:
|
|||||||
// Coin logo texture accessor (DragonX currency icon for balance tab)
|
// Coin logo texture accessor (DragonX currency icon for balance tab)
|
||||||
ImTextureID getCoinLogoTexture() const { return coin_logo_tex_; }
|
ImTextureID getCoinLogoTexture() const { return coin_logo_tex_; }
|
||||||
|
|
||||||
// DragonX custom chat emoji (the ":drgx:" shortcode) — the mark in fixed brand colors, lazily
|
// DragonX custom chat emoji (the ":drgx:" shortcode) — the mark recolored to the theme accent (like
|
||||||
// rasterized. Used by the emoji picker tile + inline in chat bubbles.
|
// the logo), re-rasterized on theme change. Used by the emoji picker tile + inline in chat bubbles.
|
||||||
ImTextureID getDrgxEmojiTexture() const { return drgx_emoji_tex_; }
|
ImTextureID getDrgxEmojiTexture() const { return drgx_emoji_tex_; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1089,7 +1089,7 @@ private:
|
|||||||
bool logo_loaded_ = false;
|
bool logo_loaded_ = false;
|
||||||
bool logo_is_dark_variant_ = true; // tracks which variant is currently loaded
|
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)
|
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;
|
int drgx_emoji_w_ = 0, drgx_emoji_h_ = 0;
|
||||||
|
|
||||||
// Coin logo texture (DragonX currency icon, separate from wallet branding)
|
// Coin logo texture (DragonX currency icon, separate from wallet branding)
|
||||||
|
|||||||
Reference in New Issue
Block a user