nixos/settings/ui.nix
rope b5372d46f3 ink ladder: base03/base04 derive from base05, shared with hyprland
base03/base04/base05 were three independent slots off the wallpaper, not
one ink at three strengths. On wallhaven-k8dqr6 the raw ladder is red,
blue and cream; on 5y39p9 base03 is a saturated gold against pale cream.
That is why muted labels read as a second accent and why the shell frame
never quite matched the window border beside it.

base04 and base03 are now base05 mixed toward base00. The two factors and
the mix live in settings/ui.nix and are used by all three consumers:
Theme.qml, theming.nix's hypr.lua (applied at runtime) and hyprland.nix's
build-time fallback. Same trick base01/base02 already used for surfaces.

Verified on 5y39p9: hypr.lua now emits aca888 / 727761 from base05 f1e2b6
against base00 0a1f1c, matching what inkStep computes in the shell.
2026-08-31 13:03:45 +01:00

49 lines
2.4 KiB
Nix

# settings/ui.nix — shared UI metrics.
#
# Single source of truth for corner rounding. Both the quickshell shell
# (settings/quickshell.nix -> Theme.qml) and hyprland's window decoration
# (settings/hyprland.nix) read `radius` from here, and every other rounding
# value is derived from it, so this one number rescales the roundness of the
# whole desktop — panels, cards, pills, hover rows and window corners.
#
# Derived values live next to their consumers:
# Theme.radiusCard = radius - panelGap (concentric nesting, see Theme.qml)
# Theme.radiusSmall = radius * 0.75
# Theme.radiusTiny = radius * 0.5
# hyprland decoration.rounding = radius
{
radius = 20;
# ── Ink ladder ────────────────────────────────────────────────────────
# base05 is the wallpaper's ink. base04 and base03 are THAT colour mixed
# toward the background, not stylix's own base03/base04: those are three
# independent slots off the image and routinely land in unrelated hues —
# on walls/wallhaven-k8dqr6 the raw ladder is red (base03), blue (base04)
# and cream (base05). Mixing gives one colour at three strengths, which is
# the same trick quickshell's Theme.base01/base02 already use for surfaces.
#
# Read by settings/quickshell.nix (Theme.qml), settings/theming.nix
# (hypr.lua, applied at runtime) and settings/hyprland.nix (the build-time
# fallback), so the shell frame and hyprland's window borders are the same
# colour rather than two slots that happen to be near each other.
inkMuted = 0.30; # base04 — secondary text, hyprland's active border
inkFaint = 0.55; # base03 — disabled text, hyprland's inactive border
# Mix two "rrggbb" strings. t = 0 keeps `a`, t = 1 lands on `b`.
mixHex = a: b: t:
let
digits = "0123456789abcdef";
val = ch: {
"0"=0; "1"=1; "2"=2; "3"=3; "4"=4; "5"=5; "6"=6; "7"=7;
"8"=8; "9"=9; "a"=10; "b"=11; "c"=12; "d"=13; "e"=14; "f"=15;
"A"=10; "B"=11; "C"=12; "D"=13; "E"=14; "F"=15;
}.${ch};
byte = s: i: val (builtins.substring i 1 s) * 16
+ val (builtins.substring (i + 1) 1 s);
chan = i:
let
n = builtins.floor (byte a i + (byte b i - byte a i) * t + 0.5);
hi = n / 16;
in builtins.substring hi 1 digits + builtins.substring (n - hi * 16) 1 digits;
in chan 0 + chan 2 + chan 4;
}