feat(settings): adjustable opacity for the favorite gold outline + star

Adds a "Favorite Highlight Opacity" slider (15-100%, default 100%) to
Settings > Appearance > Scale & Effects. It scales the alpha of the four
favorite gold tokens (fill/border/icon/outline) at their resolve site in
the Balance address list via material::ScaleAlpha, so the gold row outline
and the star button fade together. The multiplier is skin-agnostic (it
scales whatever alpha the theme resolved) and touches only favorited rows;
non-favorite rows and the white selection highlight are unchanged, and the
100% default is byte-identical to the previous look.

The preference lives in Settings (favorite_opacity, clamped 0.15-1.0 in both
the setter and on load), persists across restarts, updates live, and is not
low-spec gated (it's a pure color-alpha preference, independent of the
transparency sliders). New i18n keys favorite_opacity / tt_favorite_opacity
are translated into all eight locales; the CJK subset font is rebuilt to add
the two new glyphs the zh string needs.

Verified: full + lite builds clean, full + lite test suites pass, hygiene OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 09:58:17 -05:00
co-authored by Claude Opus 4.8
parent e40c6c0a7c
commit 5fcab14e4e
14 changed files with 61 additions and 4 deletions
+3
View File
@@ -204,6 +204,8 @@ bool Settings::load(const std::string& path)
ui_opacity_ = 1.0f; // legacy: reduced = fully opaque
}
loadScalar(j, "window_opacity", window_opacity_);
loadScalar(j, "favorite_opacity", favorite_opacity_);
favorite_opacity_ = std::clamp(favorite_opacity_, 0.15f, 1.0f); // matches setFavoriteOpacity()
if (j.contains("balance_layout")) {
if (j["balance_layout"].is_string())
balance_layout_ = j["balance_layout"].get<std::string>();
@@ -542,6 +544,7 @@ bool Settings::save(const std::string& path)
j["gradient_background"] = gradient_background_;
j["ui_opacity"] = ui_opacity_;
j["window_opacity"] = window_opacity_;
j["favorite_opacity"] = favorite_opacity_;
j["balance_layout"] = balance_layout_; // saved as string ID
j["portfolio_style"] = portfolio_style_;
j["contacts_view_mode"] = contacts_view_mode_;
+6
View File
@@ -261,6 +261,11 @@ public:
float getNoiseOpacity() const { return noise_opacity_; }
void setNoiseOpacity(float v) { noise_opacity_ = v; }
// Opacity multiplier for the favorite gold visuals (row outline + star button) in the
// Balance address list. 1.0 = theme default (unchanged); floor 0.15 so it can't vanish.
float getFavoriteOpacity() const { return favorite_opacity_; }
void setFavoriteOpacity(float v) { favorite_opacity_ = std::max(0.15f, std::min(1.0f, v)); }
// Gradient background mode (use gradient variant of theme background)
bool getGradientBackground() const { return gradient_background_; }
void setGradientBackground(bool v) { gradient_background_ = v; }
@@ -685,6 +690,7 @@ private:
int acrylic_quality_ = 2;
float blur_multiplier_ = 0.10f;
float noise_opacity_ = 0.5f;
float favorite_opacity_ = 1.0f; // Favorite gold outline/star opacity multiplier (0.15–1.0, 1.0 = theme default)
bool gradient_background_ = false;
#ifdef _WIN32
float ui_opacity_ = 0.50f; // Card/sidebar opacity (0.3–1.0, 1.0 = opaque)
+27
View File
@@ -106,6 +106,7 @@ struct SettingsPageState {
float noise_opacity = 0.5f;
float ui_opacity = 1.0f;
float window_opacity = 1.0f;
float favorite_opacity = 1.0f;
std::string balance_layout = "classic";
bool scanline_enabled = true;
bool theme_effects_enabled = true;
@@ -448,6 +449,7 @@ static void loadSettingsPageState(App* app) {
s_settingsState.acrylic_enabled = (s_settingsState.blur_amount > 0.001f);
s_settingsState.ui_opacity = settings->getUIOpacity();
s_settingsState.window_opacity = settings->getWindowOpacity();
s_settingsState.favorite_opacity = settings->getFavoriteOpacity();
s_settingsState.noise_opacity = settings->getNoiseOpacity();
s_settingsState.gradient_background = settings->getGradientBackground();
@@ -532,6 +534,7 @@ static void saveSettingsPageState(config::Settings* settings) {
settings->setBlurMultiplier(blur);
settings->setUIOpacity(lowSpecOverrides ? realPrefs.ui_opacity : s_settingsState.ui_opacity);
settings->setWindowOpacity(s_settingsState.window_opacity); // 1.0 under low-spec, as the hotkey saves it
settings->setFavoriteOpacity(s_settingsState.favorite_opacity); // not low-spec gated — cosmetic
settings->setNoiseOpacity(s_settingsState.noise_opacity);
settings->setGradientBackground(s_settingsState.gradient_background);
settings->setScanlineEnabled(lowSpecOverrides ? realPrefs.scanline_enabled : s_settingsState.scanline_enabled);
@@ -1025,6 +1028,30 @@ void RenderSettingsPage(App* app) {
ImGui::Dummy(ImVec2(0, Layout::spacingMd()));
// --- Favorite highlight opacity (gold outline + star button in the Balance address list) ---
// Pure color-alpha preference; not low-spec gated (unlike the transparency sliders below).
{
ImGui::PushFont(body2);
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetColorU32(OnSurfaceMedium()));
ImGui::TextUnformatted(TR("favorite_opacity"));
ImGui::PopStyleColor();
float favSliderW = std::min(std::max(S.drawElement("components.settings-page", "effects-input-min-width").size, contentW), 360.0f * dp);
ImGui::SetNextItemWidth(favSliderW);
{
char favop_fmt[16];
snprintf(favop_fmt, sizeof(favop_fmt), "%.0f%%%%", s_settingsState.favorite_opacity * 100.0f);
if (ImGui::SliderFloat("##FavoriteOpacity", &s_settingsState.favorite_opacity, 0.15f, 1.0f, favop_fmt,
ImGuiSliderFlags_AlwaysClamp)) {
if (app->settings()) app->settings()->setFavoriteOpacity(s_settingsState.favorite_opacity); // live; persisted on release
}
}
if (ImGui::IsItemDeactivatedAfterEdit()) saveSettingsPageState(app->settings());
if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("tt_favorite_opacity"));
ImGui::PopFont();
}
ImGui::Dummy(ImVec2(0, Layout::spacingMd()));
// --- Effect toggles (always visible, horizontal wrapping flow) ---
{
ImGui::PushFont(body2);
+7 -4
View File
@@ -285,10 +285,13 @@ void RenderSharedAddressList(App* app, float listH, float availW,
float innerW = ImGui::GetContentRegionAvail().x;
// Theme colors for buttons (resolved once)
ImU32 favGoldFill = S.resolveColor("var(--favorite-fill)", IM_COL32(255, 200, 50, 40));
ImU32 favGoldBorder = S.resolveColor("var(--favorite-border)", IM_COL32(255, 200, 50, 100));
ImU32 favGoldIcon = S.resolveColor("var(--favorite-icon)", IM_COL32(255, 200, 50, 255));
ImU32 favGoldOutline= S.resolveColor("var(--favorite-outline)", IM_COL32(255, 200, 50, 120));
// User-adjustable opacity for the favorite gold visuals (Settings > Appearance). 1.0 =
// theme default (unchanged); scales whatever alpha the skin resolved, so it is skin-agnostic.
const float favOp = app->settings() ? app->settings()->getFavoriteOpacity() : 1.0f;
ImU32 favGoldFill = ScaleAlpha(S.resolveColor("var(--favorite-fill)", IM_COL32(255, 200, 50, 40)), favOp);
ImU32 favGoldBorder = ScaleAlpha(S.resolveColor("var(--favorite-border)", IM_COL32(255, 200, 50, 100)), favOp);
ImU32 favGoldIcon = ScaleAlpha(S.resolveColor("var(--favorite-icon)", IM_COL32(255, 200, 50, 255)), favOp);
ImU32 favGoldOutline= ScaleAlpha(S.resolveColor("var(--favorite-outline)", IM_COL32(255, 200, 50, 120)), favOp);
ImU32 btnFill = S.resolveColor("var(--row-button-fill)", IM_COL32(255, 255, 255, 12));
ImU32 btnFillHov = S.resolveColor("var(--row-button-fill-hover)", IM_COL32(255, 255, 255, 25));
ImU32 btnBorder = S.resolveColor("var(--row-button-border)", IM_COL32(255, 255, 255, 25));
+2
View File
@@ -520,6 +520,7 @@ void I18n::loadBuiltinEnglish()
strings_["noise"] = "Noise";
strings_["ui_opacity"] = "UI Opacity";
strings_["window_opacity"] = "Window Opacity";
strings_["favorite_opacity"] = "Favorite Highlight Opacity";
strings_["font_scale"] = "Font Scale";
strings_["refresh"] = "Refresh";
strings_["website"] = "Website";
@@ -795,6 +796,7 @@ void I18n::loadBuiltinEnglish()
strings_["tt_noise"] = "Grain texture intensity (0% = off, 100% = maximum)";
strings_["tt_ui_opacity"] = "Card and sidebar opacity (100% = fully opaque, lower = more see-through)";
strings_["tt_window_opacity"] = "Background opacity (lower = desktop visible through window)";
strings_["tt_favorite_opacity"] = "Opacity of the favorite star button and its gold outline in the address list (minimum 15%)";
strings_["tt_font_scale"] = "Scale all text and UI (1.0x = default, up to 1.5x). Hotkey: Alt + Scroll Wheel";
strings_["tt_custom_theme"] = "Custom theme active";
strings_["tt_address_book"] = "Manage saved addresses for quick sending";