mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[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:
parent
a127ff7e1b
commit
21db8c34c9
3 changed files with 8 additions and 23 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue