[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.
This commit is contained in:
Lukas Brübach 2026-09-11 20:34:52 +02:00 • committed by GitHub
parent af55dd3da0
commit 3a43ac2935
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 23 deletions

View file

@ -11,8 +11,8 @@ namespace HomeTabButtonColor
*/ */
enum Source enum Source
{ {
Automatic, ///< Extract color from background, or use theme color if no background FromThemeColors, ///< Use the theme's identity accent colors
FromBackground, ///< Always extract color from background FromBackground, ///< Extract colour from the background image
}; };
struct Entry struct Entry
@ -23,7 +23,7 @@ struct Entry
inline QList<Entry> all() inline QList<Entry> all()
{ {
static QList<Entry> entries = {{Automatic, QT_TR_NOOP("Automatic")}, static QList<Entry> entries = {{FromThemeColors, QT_TR_NOOP("From theme colors")},
{FromBackground, QT_TR_NOOP("Extract from background")}}; {FromBackground, QT_TR_NOOP("Extract from background")}};
return entries; return entries;
@ -33,12 +33,12 @@ inline QList<Entry> all()
* Safely converts an int into the corresponding Source. * Safely converts an int into the corresponding Source.
* *
* @param value The int value * @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) inline Source intToSource(int value)
{ {
if (value > FromBackground) { if (value > FromBackground) {
return Automatic; // default return FromThemeColors; // default
} }
return static_cast<Source>(value); return static_cast<Source>(value);

View file

@ -106,12 +106,6 @@ void HomeWidget::loadBackgroundSourceDeck()
backgroundSourceDeck = deckOpt.has_value() ? deckOpt.value().deckList : DeckList(); 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<QColor, QColor> paletteDerivedButtonColors() static QPair<QColor, QColor> paletteDerivedButtonColors()
{ {
return {themeManager->appColor(AppColor::AccentStrong), themeManager->appColor(AppColor::AccentSoft)}; return {themeManager->appColor(AppColor::AccentStrong), themeManager->appColor(AppColor::AccentSoft)};
@ -123,17 +117,8 @@ QPair<QColor, QColor> HomeWidget::determineButtonColor() const
HomeTabButtonColor::intToSource(SettingsCache::instance().appearance().getHomeTabButtonColorSourceIndex()); HomeTabButtonColor::intToSource(SettingsCache::instance().appearance().getHomeTabButtonColorSourceIndex());
switch (colorSource) { switch (colorSource) {
case HomeTabButtonColor::Automatic: { case HomeTabButtonColor::FromThemeColors:
if (usesThemeBackground() && themeManager->isBuiltInTheme()) { return paletteDerivedButtonColors();
// 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::FromBackground: case HomeTabButtonColor::FromBackground:
return extractDominantColors(background); return extractDominantColors(background);
} }

View file

@ -510,7 +510,7 @@ void AppearanceSettingsPage::retranslateUi()
homeTabDisplayCardNameCheckBox.setText(tr("Display card name of background in bottom right")); homeTabDisplayCardNameCheckBox.setText(tr("Display card name of background in bottom right"));
homeTabButtonColorSourceLabel.setText(tr("Home tab button color:")); homeTabButtonColorSourceLabel.setText(tr("Home tab button color:"));
homeTabButtonColorSourceBox.setToolTip( 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")); playmatGroupBox->setTitle(tr("Playmat settings"));
playmatVisibilityLabel.setText(tr("Playmat visibility:")); playmatVisibilityLabel.setText(tr("Playmat visibility:"));