Dolphin's selection color is stuck on stock Breeze blue outside a full Plasma session (unfixed upstream regression, see README) - dropped it for Thunar. Getting Thunar themed exposed a chain of GTK3-specific issues fixed along the way: !important is silently rejected by GTK3's CSS parser (not just deprioritized), the widget and icon themes resolve via completely different mechanisms under Hyprland (no XSETTINGS daemon), and Thunar's ExoIconView grid reads its selection color from a named @define-color instead of normal :selected matching. Folder icon colors are now generated to match the accent exactly (theme/icon_theme.py, no sudo) instead of snapping to a papirus-folders preset. Also adds the kde-colorscheme template (the missing piece KColorSchemeManager actually resolves ColorScheme= against) and new gtk_selection_color/gtk_selection_opacity palette keys with widget controls, following the existing bar/pill/popup color+opacity pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
62 lines
2.6 KiB
Python
62 lines
2.6 KiB
Python
"""Generates a tiny user icon theme with folder icons in the exact palette accent.
|
|
|
|
Unlike papirus-folders (~20 fixed presets, needs sudo since it writes into
|
|
/usr/share/icons), this writes into ~/.local/share/icons - no sudo, and it matches
|
|
the accent exactly instead of snapping to the nearest preset. Called from render.py
|
|
on every render, so folder icons are fully live like the rest of the palette.
|
|
|
|
Works by taking Papirus-Dark's own "blue" folder SVGs (arbitrarily chosen as the
|
|
source shapes - a plain two-tone folder, not on a plain color hex code) and replacing
|
|
its two fixed colors with the accent and a darkened variant of it.
|
|
"""
|
|
import os
|
|
import re
|
|
|
|
SOURCE_THEME = "/usr/share/icons/Papirus-Dark"
|
|
DEST_THEME = os.path.expanduser("~/.local/share/icons/AetherRice")
|
|
SIZES = ["16x16", "22x22", "24x24", "32x32", "48x48", "64x64"]
|
|
|
|
# The "blue" preset's two colors - main face and the darker top-flap shade - swapped
|
|
# out below for the accent and a darkened version of it. Any preset would do as the
|
|
# source shapes; blue was just picked arbitrarily.
|
|
REF_MAIN = "#5294e2"
|
|
REF_FLAP = "#4877b1"
|
|
|
|
VARIANTS = {"folder.svg": "folder-blue.svg", "folder-open.svg": "folder-blue-open.svg"}
|
|
|
|
|
|
def _darken(hex_color, factor=0.8):
|
|
h = hex_color.lstrip("#")
|
|
r, g, b = (int(h[i:i + 2], 16) for i in (0, 2, 4))
|
|
return "#{:02x}{:02x}{:02x}".format(*(max(0, min(255, int(c * factor))) for c in (r, g, b)))
|
|
|
|
|
|
def render(colors):
|
|
accent = colors["accent"]
|
|
flap = _darken(accent)
|
|
sections = []
|
|
for size in SIZES:
|
|
src_dir = os.path.join(SOURCE_THEME, size, "places")
|
|
dest_dir = os.path.join(DEST_THEME, size, "places")
|
|
os.makedirs(dest_dir, exist_ok=True)
|
|
for dest_name, src_name in VARIANTS.items():
|
|
src_path = os.path.join(src_dir, src_name)
|
|
if not os.path.isfile(src_path):
|
|
continue
|
|
svg = open(src_path).read()
|
|
svg = re.sub(REF_MAIN, accent, svg, flags=re.IGNORECASE)
|
|
svg = re.sub(REF_FLAP, flap, svg, flags=re.IGNORECASE)
|
|
open(os.path.join(dest_dir, dest_name), "w").write(svg)
|
|
px = size.split("x")[0]
|
|
sections.append(f"[{size}/places]\nContext=Places\nSize={px}\nType=Fixed\n")
|
|
|
|
dirs = ",".join(f"{size}/places" for size in SIZES)
|
|
index = (
|
|
"[Icon Theme]\n"
|
|
"Name=AetherRice\n"
|
|
"Comment=Papirus-Dark with folder icons generated by theme/render.py from the palette accent\n"
|
|
"Inherits=Papirus-Dark\n"
|
|
f"Directories={dirs}\n\n" + "\n".join(sections)
|
|
)
|
|
open(os.path.join(DEST_THEME, "index.theme"), "w").write(index)
|