[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 a127ff7e1b
commit 21db8c34c9
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
{
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<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")}};
return entries;
@ -33,12 +33,12 @@ inline QList<Entry> 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<Source>(value);

View file

@ -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<QColor, QColor> paletteDerivedButtonColors()
{
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());
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);
}

View file

@ -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:"));