Cockatrice/cockatrice
BruebachL 6c1d1c7b58
[Client] Add [AppColors] application palette roles (#7279)
* [Client] Add [AppColors] application palette roles

The home-tab buttons' gradient over the static theme background was hardcoded, and accent-derived fallbacks could not be themed or edited: QPalette's role set is closed, so any application-specific color has to live in Cockatrice's own palette layer.

- Add an AppColor::Role enum (AccentStrong / AccentSoft) stored on PaletteConfig and round-tripped from palette-<scheme>.toml under a new [AppColors] section.
- Cache the applied app colors in ThemeManager and expose appColor(Role) with a palette-accent-derived fallback; emit paletteChanged() from applyStyleAndPalette so previews, scheme switches and OS dark mode repaint palette-driven widgets.
- Fill both app roles in PaletteGenerator::fromAccent and surface them as a dedicated section in the palette editor.
- Drive the home-tab buttons from appColor() whenever the background source is the theme (any theme, not just built-ins).
- Ship AccentStrong / AccentSoft values in the Fusion and Default default palettes so the static home-tab buttons keep their classic greens.

# Conflicts:
#	cockatrice/src/interface/widgets/general/home_widget.cpp

* [AppColors] Address review comments

- PaletteEditorDialog::onSave(): compare whole PaletteConfig (colors and
  appColors) so a change to only AccentStrong/AccentSoft writes the file;
  add PaletteConfig::operator==.
- appColor(): derive both roles from QPalette::Highlight unconditionally.
  The Fusion palettes pin Accent to near-Window values, and QPalette::Accent
  only exists on Qt 6.6+, so keying on it made identical themes render very
  differently across Qt versions.
- themeChangedSlot(): merge the theme default's [AppColors] into a custom
  palette that predates the section instead of all-or-nothing per file;
  hasPalette() now counts an appColors-only file as a palette.
- Add Default/palette-default-light.toml so the Default theme's Light scheme
  keeps the classic greens instead of falling back to the OS accent.
- home_widget: restore the isBuiltInTheme() half of the Automatic condition;
  non-built-in themes extract button colors from their own background art.
- palette_grid_widget: use appEnum.value(i) for the role cast (3 sites),
  append appHeader to headerLabels, fix the 'Lighted' typo.

* [Themes] Route theme writes to the user themes directory

setColorScheme()/setStyleName() and the palette editor wrote directly to
the resolved theme directory, which for built-in themes is the read-only
system (install) location. Changes therefore landed in the install dir and
were lost on upgrade.

Add ThemeManager::writableThemeDir(), which always resolves to the user
themes directory, and route all theme writes through it. The palette editor
reuses the same helper, dropping its private writability probe.

* [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.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-09-18 15:16:06 +02:00
..
resources Allow to filter sets by release date (#7239) 2026-09-05 11:58:37 -07:00
sounds Add cmake format (#4618) 2022-05-08 21:22:43 +02:00
src [Client] Add [AppColors] application palette roles (#7279) 2026-09-18 15:16:06 +02:00
themes [Client] Add [AppColors] application palette roles (#7279) 2026-09-18 15:16:06 +02:00
translations Update translation files (#7044) 2026-07-16 09:07:33 +02:00
.qdevelop icon_draw and icon_untap added, icon_general and icon_messages modified 2009-07-31 13:37:16 +02:00
CMakeLists.txt [Server/Client/Protocol] Add developer staff role (#7211) 2026-09-11 17:18:56 +02:00
cockatrice-cod.xml Define Cockatrice as an editor/handler for .cod files and cockatrice:// protocol on all platforms (#6775) 2026-08-08 19:02:19 +02:00
cockatrice.desktop Define Cockatrice as an editor/handler for .cod files and cockatrice:// protocol on all platforms (#6775) 2026-08-08 19:02:19 +02:00
cockatrice.qrc [App] Add onboarding wizard (#7064) 2026-08-24 23:05:58 +02:00
cockatrice.rc Included uninstaller for Windows version 2010-09-17 15:26:07 +02:00
cockatrice_en@source.ts Update translation source strings (#7028) 2026-07-01 16:25:10 +02:00