Dark mode for KDE/Qt apps: write kdeglobals colors and set QT_QPA_PLATFORMTHEME
CI / test (push) Failing after 17s

KWrite stayed light with the Dark mode switch on. KDE apps read their colors
from the [Colors:*] groups of kdeglobals, not from the scheme's name, and the
switch only set [General] ColorScheme with kwriteconfig. Qt 6 apps also had no
platform theme under XDG_CURRENT_DESKTOP=chandra, so Qt reported an unknown
(light) color scheme whatever the portal said, and KDE Frameworks 6 apps
picked Breeze Light.

- session/chandra-kde-colors dark|light copies the scheme's color groups into
  kdeglobals (counterpart of the current scheme, else Breeze, else Chandra's
  own ChandraDark/ChandraLight) and emits KGlobalSettings.notifyChange so
  running apps repaint. The compositor calls it from the switch.
- chandra-session sets QT_QPA_PLATFORMTHEME to kde (plasma-integration) or
  xdgdesktopportal when unset, and passes it to the activation environment.
- install.py installs the script and the two color schemes.
- scripts/test-kde-colors.sh tests the rewriting, and that a running KWrite
  turns dark live; docs/dark-mode.md explains it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hjmk6mgq6Gg5vgKfMp
This commit is contained in:
Claude committed 2026-11-25 22:33:29 +00:00
1 parent 114f0b4e04
commit 42aa770452
8 files changed
+523 -12

No files matched your search

+125
View File
@@ -0,0 +1,125 @@
# Chandra's own dark KDE color scheme, from the Moon Night desktop palette (config/themes).
# chandra-kde-colors uses it when Breeze's schemes aren't installed.
[Colors:Window]
BackgroundAlternate=39,49,64
BackgroundNormal=31,41,55
DecorationFocus=124,156,255
DecorationHover=124,156,255
ForegroundActive=124,156,255
ForegroundInactive=156,163,175
ForegroundLink=124,156,255
ForegroundNegative=248,113,113
ForegroundNeutral=251,191,36
ForegroundNormal=243,244,246
ForegroundPositive=74,222,128
ForegroundVisited=180,140,255
[Colors:View]
BackgroundAlternate=24,32,48
BackgroundNormal=17,24,39
DecorationFocus=124,156,255
DecorationHover=124,156,255
ForegroundActive=124,156,255
ForegroundInactive=156,163,175
ForegroundLink=124,156,255
ForegroundNegative=248,113,113
ForegroundNeutral=251,191,36
ForegroundNormal=243,244,246
ForegroundPositive=74,222,128
ForegroundVisited=180,140,255
[Colors:Button]
BackgroundAlternate=59,70,88
BackgroundNormal=55,65,81
DecorationFocus=124,156,255
DecorationHover=124,156,255
ForegroundActive=124,156,255
ForegroundInactive=156,163,175
ForegroundLink=124,156,255
ForegroundNegative=248,113,113
ForegroundNeutral=251,191,36
ForegroundNormal=243,244,246
ForegroundPositive=74,222,128
ForegroundVisited=180,140,255
[Colors:Selection]
BackgroundAlternate=98,124,210
BackgroundNormal=124,156,255
DecorationFocus=124,156,255
DecorationHover=124,156,255
ForegroundActive=11,16,32
ForegroundInactive=156,163,175
ForegroundLink=11,16,32
ForegroundNegative=248,113,113
ForegroundNeutral=251,191,36
ForegroundNormal=11,16,32
ForegroundPositive=74,222,128
ForegroundVisited=180,140,255
[Colors:Tooltip]
BackgroundAlternate=31,41,55
BackgroundNormal=17,24,39
DecorationFocus=124,156,255
DecorationHover=124,156,255
ForegroundActive=124,156,255
ForegroundInactive=156,163,175
ForegroundLink=124,156,255
ForegroundNegative=248,113,113
ForegroundNeutral=251,191,36
ForegroundNormal=243,244,246
ForegroundPositive=74,222,128
ForegroundVisited=180,140,255
[Colors:Complementary]
BackgroundAlternate=31,41,55
BackgroundNormal=17,24,39
DecorationFocus=124,156,255
DecorationHover=124,156,255
ForegroundActive=124,156,255
ForegroundInactive=156,163,175
ForegroundLink=124,156,255
ForegroundNegative=248,113,113
ForegroundNeutral=251,191,36
ForegroundNormal=243,244,246
ForegroundPositive=74,222,128
ForegroundVisited=180,140,255
[Colors:Header]
BackgroundAlternate=39,49,64
BackgroundNormal=31,41,55
DecorationFocus=124,156,255
DecorationHover=124,156,255
ForegroundActive=124,156,255
ForegroundInactive=156,163,175
ForegroundLink=124,156,255
ForegroundNegative=248,113,113
ForegroundNeutral=251,191,36
ForegroundNormal=243,244,246
ForegroundPositive=74,222,128
ForegroundVisited=180,140,255
[ColorEffects:Disabled]
Color=56,56,56
ColorAmount=0
ColorEffect=0
ContrastAmount=0.65
ContrastEffect=1
IntensityAmount=0.1
IntensityEffect=2
[ColorEffects:Inactive]
ChangeSelectionColor=true
Enable=false
[General]
ColorScheme=ChandraDark
Name=Chandra Dark
[WM]
activeBackground=31,41,55
activeBlend=243,244,246
activeForeground=243,244,246
inactiveBackground=17,24,39
inactiveBlend=156,163,175
inactiveForeground=156,163,175
+125
View File
@@ -0,0 +1,125 @@
# Chandra's own light KDE color scheme, from the Moon Day desktop palette (config/themes).
# chandra-kde-colors uses it when Breeze's schemes aren't installed.
[Colors:Window]
BackgroundAlternate=234,238,246
BackgroundNormal=244,246,251
DecorationFocus=59,107,255
DecorationHover=59,107,255
ForegroundActive=59,107,255
ForegroundInactive=91,101,119
ForegroundLink=59,107,255
ForegroundNegative=220,38,38
ForegroundNeutral=202,138,4
ForegroundNormal=27,34,51
ForegroundPositive=22,163,74
ForegroundVisited=124,58,237
[Colors:View]
BackgroundAlternate=246,248,252
BackgroundNormal=255,255,255
DecorationFocus=59,107,255
DecorationHover=59,107,255
ForegroundActive=59,107,255
ForegroundInactive=91,101,119
ForegroundLink=59,107,255
ForegroundNegative=220,38,38
ForegroundNeutral=202,138,4
ForegroundNormal=27,34,51
ForegroundPositive=22,163,74
ForegroundVisited=124,58,237
[Colors:Button]
BackgroundAlternate=210,218,232
BackgroundNormal=221,227,240
DecorationFocus=59,107,255
DecorationHover=59,107,255
ForegroundActive=59,107,255
ForegroundInactive=91,101,119
ForegroundLink=59,107,255
ForegroundNegative=220,38,38
ForegroundNeutral=202,138,4
ForegroundNormal=27,34,51
ForegroundPositive=22,163,74
ForegroundVisited=124,58,237
[Colors:Selection]
BackgroundAlternate=120,150,255
BackgroundNormal=59,107,255
DecorationFocus=59,107,255
DecorationHover=59,107,255
ForegroundActive=255,255,255
ForegroundInactive=91,101,119
ForegroundLink=255,255,255
ForegroundNegative=220,38,38
ForegroundNeutral=202,138,4
ForegroundNormal=255,255,255
ForegroundPositive=22,163,74
ForegroundVisited=124,58,237
[Colors:Tooltip]
BackgroundAlternate=244,246,251
BackgroundNormal=251,252,255
DecorationFocus=59,107,255
DecorationHover=59,107,255
ForegroundActive=59,107,255
ForegroundInactive=91,101,119
ForegroundLink=59,107,255
ForegroundNegative=220,38,38
ForegroundNeutral=202,138,4
ForegroundNormal=27,34,51
ForegroundPositive=22,163,74
ForegroundVisited=124,58,237
[Colors:Complementary]
BackgroundAlternate=234,238,246
BackgroundNormal=244,246,251
DecorationFocus=59,107,255
DecorationHover=59,107,255
ForegroundActive=59,107,255
ForegroundInactive=91,101,119
ForegroundLink=59,107,255
ForegroundNegative=220,38,38
ForegroundNeutral=202,138,4
ForegroundNormal=27,34,51
ForegroundPositive=22,163,74
ForegroundVisited=124,58,237
[Colors:Header]
BackgroundAlternate=234,238,246
BackgroundNormal=244,246,251
DecorationFocus=59,107,255
DecorationHover=59,107,255
ForegroundActive=59,107,255
ForegroundInactive=91,101,119
ForegroundLink=59,107,255
ForegroundNegative=220,38,38
ForegroundNeutral=202,138,4
ForegroundNormal=27,34,51
ForegroundPositive=22,163,74
ForegroundVisited=124,58,237
[ColorEffects:Disabled]
Color=56,56,56
ColorAmount=0
ColorEffect=0
ContrastAmount=0.65
ContrastEffect=1
IntensityAmount=0.1
IntensityEffect=2
[ColorEffects:Inactive]
ChangeSelectionColor=true
Enable=false
[General]
ColorScheme=ChandraLight
Name=Chandra Light
[WM]
activeBackground=244,246,251
activeBlend=27,34,51
activeForeground=27,34,51
inactiveBackground=234,238,246
inactiveBlend=91,101,119
inactiveForeground=91,101,119