diff options
Diffstat (limited to 'bin/udt-palette')
| -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), ] |
