diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-11 18:23:41 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-11 18:23:41 +0200 |
| commit | 1f37c129ac0b72fd2e177618ae6aed5f4233873d (patch) | |
| tree | d0a6bc9698474207b8ded528f5830c57cde5267f /bin | |
| parent | 90d92490f83156a4a90c44b3837f1037cec80132 (diff) | |
| download | unified-desktop-theme-1f37c129ac0b72fd2e177618ae6aed5f4233873d.tar.gz unified-desktop-theme-1f37c129ac0b72fd2e177618ae6aed5f4233873d.zip | |
feat(palette): generate the homepage stylesheet and stage it on install
The dashboard's custom.css was written by hand against Macchiato, so it would
have drifted the moment the desktop changed scheme. It is now generated from
the same roles as everything else and staged on the host by install.sh.
Adds four intermediate grey roles to every scheme. homepage wants a full
ten-step ramp where the other consumers want three depths, and without them
several steps collapsed onto the same colour, flattening the mid-tones.
The scp is deliberately soft: five second timeout, BatchMode, a warning rather
than a failure when the host is unreachable, so a laptop away from that network
still installs the local theme. It stages to ~/hp-stage only, because
/opt/homepage/config is root-owned; install.sh prints the sudo copy to finish.
Verified: the generated Macchiato stylesheet reproduces the deployed one
colour-for-colour, switching to tokyo-night propagates through to the staged
file, and a failing scp leaves install.sh exiting 0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015gbjA2bmswN8jyPDKzrvqe
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/udt-palette | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/bin/udt-palette b/bin/udt-palette index 60a21fa..1a1c6b0 100755 --- a/bin/udt-palette +++ b/bin/udt-palette @@ -206,6 +206,71 @@ def gen_kitty(res, scheme, palette): return "\n".join(lines) + "\n" +def gen_homepage(res, scheme, palette): + """gethomepage: a custom.css overriding its ten-step colour ramp. + + homepage themes itself with --color-50 (lightest) to --color-900 (darkest) + as space-separated RGB triples, so the ramp is filled from the text scale + at the light end and the surface scale at the dark end. + + The card backgrounds do NOT come from that ramp: in dark mode the service + and bookmark cards carry `dark:bg-white/5`, a literal white, so redefining + the variables alone leaves them a neutral grey. Upstream hits the same wall + and hardcodes those selectors for .theme-white; this does the same for + .theme-gray, which is the class settings.yaml's `color: gray` puts on the + page. Change that setting and this file stops applying. + """ + def triple(role): + r, g, b, _ = res[role] + return f"{r} {g} {b}" + + ramp = [("50", "fg"), ("100", "fg_bright"), ("200", "fg_dim"), + ("300", "mid_high"), ("400", "mid_low"), ("500", "fg_faint"), + ("600", "surface_high"), ("700", "surface_alt"), ("800", "surface"), + ("900", "bg")] + rows = "\n".join(f" --color-{n}: {triple(role)};" for n, role in ramp) + + sr, sg, sb, _ = res["surface"] + ar, ag, ab, _ = res["surface_alt"] + br, bg_, bb, _ = res["bg"] + accent = hex6(res["accent"]) + + return f"""/* {BANNER.format(scheme=scheme)} + * + * Catppuccin-independent: every colour here comes from palette/roles-{scheme} + * .conf, so this file follows the desktop rather than restating a palette. + */ + +.theme-gray {{ +{rows} + + --color-logo-start: {triple('accent')}; + --color-logo-stop: {triple('info')}; +}} + +/* Card backgrounds, which the ramp does not reach. See the note above. */ +.theme-gray .bg-theme-100\\/20:not([class^="backdrop-blur"]), +.theme-gray .dark\\:bg-white\\/5:not([class^="backdrop-blur"]) {{ + background-color: rgb({sr} {sg} {sb} / 55%); +}} + +.theme-gray .bg-theme-100\\/20:hover:not([class^="backdrop-blur"]), +.theme-gray .dark\\:bg-white\\/5:hover:not([class^="backdrop-blur"]) {{ + background-color: rgb({ar} {ag} {ab} / 70%); +}} + +.theme-gray .bg-theme-900\\/50:not([class^="backdrop-blur"]) {{ + background-color: rgb({br} {bg_} {bb} / 50%); +}} + +/* Accent on secondary labels. Fixed, not wallpaper-tracking: this runs on a + * server with no wallpaper to read. */ +.theme-gray .text-theme-500 {{ + color: {accent}; +}} +""" + + def gen_dunst(res, scheme, palette, template): """dunst: substitute colours into the shipped template. @@ -331,6 +396,7 @@ TARGETS = [ ("templates/dunstrc", gen_dunst, "templates/dunstrc.in"), ("templates/conky.conf", gen_conky, "templates/conky.conf.in"), ("bin/udt_colors.py", gen_accent_py, None), + ("templates/homepage/custom.css", gen_homepage, None), ] |
