diff options
Diffstat (limited to 'bin/udt-palette')
| -rwxr-xr-x | bin/udt-palette | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bin/udt-palette b/bin/udt-palette index 9bd3838..fbe53e6 100755 --- a/bin/udt-palette +++ b/bin/udt-palette @@ -260,6 +260,39 @@ def gen_kitty(res, scheme, palette): return "\n".join(lines) + "\n" +def gen_hyprlock(res, scheme, palette): + """hyprlock: the lock screen's scheme-level palette, as hyprlang variables. + + Only the values that move with the scheme. The accent border is a separate + generated file, written by udt-accent, because it follows the wallpaper + rather than the scheme; hyprlock.conf sources both. + + The panel alpha is a design constant, not a role: it matches the drawer's + Qt.alpha(Theme.base, 0.72), so the lock panel and the drawer read as one + surface. + """ + def with_alpha(role, alpha): + r, g, b, _ = res[role] + return f"rgba({r},{g},{b},{alpha})" + + rows = [ + ("panel", with_alpha("bg", 0.72)), + ("input_bg", rgba(res["surface"])), + ("text", rgba(res["fg"])), + ("subtext", rgba(res["fg_dim"])), + ("fail", rgba(res["critical"])), + ] + body = "\n".join(f"${name} = {value}" for name, value in rows) + + return ( + f"# {BANNER.format(scheme=scheme)}\n" + "#\n" + "# hyprlock's static palette. The accent border is generated separately\n" + "# by udt-accent, at ~/.cache/udt/hyprlock-border.conf.\n" + f"{body}\n" + ) + + def gen_obsidian(res, scheme, palette): """Obsidian: a CSS snippet overriding the theme variables. @@ -659,6 +692,7 @@ TARGETS = [ ("rofi/udt/palette.rasi", gen_rofi, None), ("templates/waybar/theme.css", gen_waybar, None), ("templates/terminal/kitty-theme.conf", gen_kitty, None), + ("templates/hyprlock/hyprlock-palette.conf", gen_hyprlock, None), (str(CONKY_REPO / "conky.conf"), gen_conky, str(CONKY_REPO / "conky.conf.in")), ("bin/udt_colors.py", gen_accent_py, None), ("templates/homepage/custom.css", gen_homepage, None), @@ -782,6 +816,14 @@ def selftest(): assert not missing, f"{scheme} is missing roles: {sorted(missing)}" assert not extra, f"{scheme} has roles no other scheme has: {sorted(extra)}" + # The hyprlock palette must name every variable the lock config references. + # A missing one renders a literal `$var`, and hyprlock then falls back to a + # default colour with nothing to say so. + _, _, res, _ = load(None, scheme=names[0]) + lock = gen_hyprlock(res, names[0], None) + for var in ("panel", "input_bg", "text", "subtext", "fail"): + assert f"${var} = " in lock, f"hyprlock palette is missing ${var}" + # Every placeholder in the GTK templates must correspond to a role, or it # renders literally and GTK drops the declaration without an error. The # stylesheets are too large to eyeball, so this is the only thing standing |
