diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-23 18:44:38 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-23 18:44:38 +0200 |
| commit | f0b0e9dbb9062c38b40cb6984be5dbc2ce12948a (patch) | |
| tree | 4104866d5a5cb59f1ccf403eb30b30d3f057562c | |
| parent | 041edc485cd81b2c564cbcaa3eb425c9ed5520e4 (diff) | |
| download | unified-desktop-theme-f0b0e9dbb9062c38b40cb6984be5dbc2ce12948a.tar.gz unified-desktop-theme-f0b0e9dbb9062c38b40cb6984be5dbc2ce12948a.zip | |
fix: theme KDE Frameworks apps off Plasma
kcalc rendered white under the dark Kvantum theme. Off Plasma,
KStyleManager forces Breeze unless kdeglobals names a widgetStyle, and
KColorSchemeManager applies BreezeLight unless kdeglobals names a colour
scheme; qt6ct never forwards the portal's prefer-dark to Qt.
Generate a udt.colors KColorScheme from the Kvantum roles, install it to
~/.local/share/color-schemes/, and point kdeglobals at it and at
kvantum-dark.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | AGENTS.md | 9 | ||||
| -rwxr-xr-x | bin/udt-palette | 44 | ||||
| -rwxr-xr-x | install.sh | 11 |
4 files changed, 64 insertions, 1 deletions
@@ -15,6 +15,7 @@ __pycache__/ /bin/udt_colors.py /templates/kvantum/theme.kvconfig /templates/kvantum/theme.svg +/templates/kde/udt.colors /templates/obsidian/udt.css /templates/gtk/gtk3.css /templates/gtk/gtk4.css @@ -41,7 +41,7 @@ switch into a diff. Editing one is pointless: the next install overwrites it. The generated set is `rofi/udt/palette.rasi`, `templates/conky.conf`, `templates/waybar/theme.css`, `templates/terminal/kitty-theme.conf`, `templates/homepage/custom.css`, -`templates/kvantum/theme.{kvconfig,svg}`, +`templates/kvantum/theme.{kvconfig,svg}`, `templates/kde/udt.colors`, `templates/sublime/udt.sublime-color-scheme`, `templates/sublime/udt.sublime-theme`, `templates/gtk/gtk{3,4}.css`, `templates/gtk/index.theme`, `templates/gtk/assets/*.svg`, @@ -82,6 +82,13 @@ stylesheets and their 67 widget assets are now templates rendered into GTK4 symlink are set once. See `templates/gtk/README.md` for what is substituted and what is deliberately left as upstream drew it. +**KDE Frameworks apps (kcalc etc.) skip qt6ct twice off Plasma.** +`KStyleManager` forces Breeze unless kdeglobals `[KDE] widgetStyle` is set, and +`KColorSchemeManager` applies BreezeLight unless `[UiSettings] ColorScheme` +names a scheme; qt6ct never passes the portal's `prefer-dark` to Qt. Either +alone left kcalc white. `install.sh` installs a generated `udt.colors` into +`~/.local/share/color-schemes/` and sets both keys with `kwriteconfig6`. + **Qt apps only read a theme at startup**, so a running one keeps the old colours until restarted. `install.sh` cannot signal them and does not try. diff --git a/bin/udt-palette b/bin/udt-palette index fbe53e6..04451f7 100755 --- a/bin/udt-palette +++ b/bin/udt-palette @@ -404,6 +404,49 @@ def gen_kvantum(res, scheme, palette, template): return out +def gen_kde(res, scheme, palette): + """KDE Frameworks apps: a KColorScheme file, the same roles as Kvantum. + + Off Plasma, KColorSchemeManager ignores the Qt style's palette and falls + back to BreezeLight unless kdeglobals names a scheme, which is how kcalc + ended up white under a dark Kvantum theme. install.sh points kdeglobals at + this file. Colours are r,g,b triplets; the accent is the scheme's own, + since these apps read it once at startup. + """ + def rgb(role): + r, g, b, _ = res[role] + return f"{r},{g},{b}" + + fg = { + "ForegroundNormal": "fg", "ForegroundInactive": "fg_dim", + "ForegroundActive": "accent", "ForegroundLink": "accent", + "ForegroundVisited": "accent_bright", "ForegroundNegative": "critical", + "ForegroundNeutral": "warning", "ForegroundPositive": "success", + "DecorationFocus": "accent", "DecorationHover": "accent", + } + sets = { + "Window": ("bg", "surface"), + "View": ("bg_alt", "bg"), + "Button": ("surface", "surface_alt"), + "Header": ("bg", "surface"), + "Tooltip": ("bg_alt", "surface"), + "Complementary": ("bg_alt", "surface"), + "Selection": ("accent", "accent_dim"), + } + out = [f"# {BANNER.format(scheme=scheme)}", "[General]", + "ColorScheme=udt", "Name=udt", ""] + for name, (bg, bg_alt) in sets.items(): + roles = dict(fg, BackgroundNormal=bg, BackgroundAlternate=bg_alt) + if name == "Selection": + # Text on a solid accent fill, so it takes the dark end. + roles.update(ForegroundNormal="bg", ForegroundActive="bg", + ForegroundInactive="surface") + out.append(f"[Colors:{name}]") + out += [f"{k}={rgb(v)}" for k, v in sorted(roles.items())] + out.append("") + return "\n".join(out) + + # Shades upstream computed from a palette colour rather than taking one. Each # paints exactly one widget surface, so leaving them literal (the rule that is # right for the neutral greys) left twelve lavender and Macchiato-tinted spots @@ -700,6 +743,7 @@ TARGETS = [ ("templates/typora/udt.css", gen_typora, "templates/typora/udt.css.in"), ("templates/kvantum/theme.kvconfig", gen_kvantum, "templates/kvantum/theme.kvconfig.in"), ("templates/kvantum/theme.svg", gen_kvantum, "templates/kvantum/theme.svg.in"), + ("templates/kde/udt.colors", gen_kde, None), ("templates/sublime/udt.sublime-color-scheme", gen_sublime, "templates/sublime/udt.sublime-color-scheme.in"), ("templates/sublime/udt.sublime-theme", gen_sublime_theme, @@ -137,6 +137,17 @@ install -Dm644 "$repo/templates/kvantum/theme.kvconfig" "$kv/udt.kvconfig" install -Dm644 "$repo/templates/kvantum/theme.svg" "$kv/udt.svg" printf '[General]\ntheme=udt\n' > "$HOME/.config/Kvantum/kvantum.kvconfig" +# KDE Frameworks apps (kcalc and friends) bypass qt6ct twice over off Plasma: +# KStyleManager forces Breeze unless kdeglobals names a widgetStyle, and +# KColorSchemeManager applies BreezeLight unless kdeglobals names a scheme. +# kdeglobals is edited in place, two keys only, like the gsettings calls below. +install -Dm644 "$repo/templates/kde/udt.colors" \ + "$HOME/.local/share/color-schemes/udt.colors" +if command -v kwriteconfig6 >/dev/null 2>&1; then + kwriteconfig6 --file kdeglobals --group UiSettings --key ColorScheme udt + kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle kvantum-dark +fi + # GTK3 and GTK4. Installed under one fixed name for every scheme, like Kvantum: # the theme name is set in gsettings and in a symlink, so a per-scheme name # would mean rewriting both on every switch and leaving stale themes behind. |
