From 3a43ac29352c2af805383249cc690e297432ccf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Fri, 11 Sep 2026 20:34:52 +0200 Subject: [PATCH] [Home] Replace 'Automatic' button color with explicit theme colors default The Automatic option gated on isBuiltInTheme(): built-in themes used the theme's accent colors, while non-built-in themes extracted colors from their own background art. That made the result depend on the theme's origin rather than what the user actually sees. Remove Automatic and expose two explicit choices: 'From theme colors' (always the theme's identity accents, now the default) and 'Extract from background' (always sample the painted background). Drop the now-unused isBuiltInTheme() helper. --- .../widgets/general/home_tab_button_color.h | 10 +++++----- .../interface/widgets/general/home_widget.cpp | 19 ++----------------- .../appearance_settings_page.cpp | 2 +- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/cockatrice/src/interface/widgets/general/home_tab_button_color.h b/cockatrice/src/interface/widgets/general/home_tab_button_color.h index 1550b57e7..b45bd7a92 100644 --- a/cockatrice/src/interface/widgets/general/home_tab_button_color.h +++ b/cockatrice/src/interface/widgets/general/home_tab_button_color.h @@ -11,8 +11,8 @@ namespace HomeTabButtonColor */ enum Source { - Automatic, ///< Extract color from background, or use theme color if no background - FromBackground, ///< Always extract color from background + FromThemeColors, ///< Use the theme's identity accent colors + FromBackground, ///< Extract colour from the background image }; struct Entry @@ -23,7 +23,7 @@ struct Entry inline QList all() { - static QList entries = {{Automatic, QT_TR_NOOP("Automatic")}, + static QList entries = {{FromThemeColors, QT_TR_NOOP("From theme colors")}, {FromBackground, QT_TR_NOOP("Extract from background")}}; return entries; @@ -33,12 +33,12 @@ inline QList all() * Safely converts an int into the corresponding Source. * * @param value The int value - * @return The Source. Returns Source::Automatic if the value is not within range + * @return The Source. Returns Source::FromThemeColors if the value is not within range */ inline Source intToSource(int value) { if (value > FromBackground) { - return Automatic; // default + return FromThemeColors; // default } return static_cast(value); diff --git a/cockatrice/src/interface/widgets/general/home_widget.cpp b/cockatrice/src/interface/widgets/general/home_widget.cpp index 0f96dcd52..27fd065a5 100644 --- a/cockatrice/src/interface/widgets/general/home_widget.cpp +++ b/cockatrice/src/interface/widgets/general/home_widget.cpp @@ -106,12 +106,6 @@ void HomeWidget::loadBackgroundSourceDeck() backgroundSourceDeck = deckOpt.has_value() ? deckOpt.value().deckList : DeckList(); } -static bool usesThemeBackground() -{ - QString sourceId = SettingsCache::instance().appearance().getHomeTabBackgroundSource(); - return BackgroundSources::fromId(sourceId) == BackgroundSources::Theme; -} - static QPair paletteDerivedButtonColors() { return {themeManager->appColor(AppColor::AccentStrong), themeManager->appColor(AppColor::AccentSoft)}; @@ -123,17 +117,8 @@ QPair HomeWidget::determineButtonColor() const HomeTabButtonColor::intToSource(SettingsCache::instance().appearance().getHomeTabButtonColorSourceIndex()); switch (colorSource) { - case HomeTabButtonColor::Automatic: { - if (usesThemeBackground() && themeManager->isBuiltInTheme()) { - // Built-in themes paint a static theme background; follow the - // theme's identity accent colors rather than sampling the image. - return paletteDerivedButtonColors(); - } else { - // Non-built-in themes may ship their own background art, so - // extract the button colors from the image actually painted. - return extractDominantColors(background); - } - } + case HomeTabButtonColor::FromThemeColors: + return paletteDerivedButtonColors(); case HomeTabButtonColor::FromBackground: return extractDominantColors(background); } diff --git a/cockatrice/src/interface/widgets/settings_page/appearance_settings_page.cpp b/cockatrice/src/interface/widgets/settings_page/appearance_settings_page.cpp index c8494f095..c45373757 100644 --- a/cockatrice/src/interface/widgets/settings_page/appearance_settings_page.cpp +++ b/cockatrice/src/interface/widgets/settings_page/appearance_settings_page.cpp @@ -510,7 +510,7 @@ void AppearanceSettingsPage::retranslateUi() homeTabDisplayCardNameCheckBox.setText(tr("Display card name of background in bottom right")); homeTabButtonColorSourceLabel.setText(tr("Home tab button color:")); homeTabButtonColorSourceBox.setToolTip( - tr("Automatic: extract from background if present, otherwise use theme default")); + tr("Use the theme's identity accent colors, or extract colors from the background image")); playmatGroupBox->setTitle(tr("Playmat settings")); playmatVisibilityLabel.setText(tr("Playmat visibility:"));