This commit is contained in:
elwrcl committed 2026-10-20 00:29:18 +03:00
1 parent 3e4799d163
commit 5bbc81a1bc
1 file changed
+49 -27
+49 -27
View File
@@ -1,38 +1,60 @@
{ ... }: { ... }:
{ {
flake.homeModules.home-theme-ghostty = flake.homeModules.home-theme-ghostty =
{ config, ... }: { config, lib, ... }:
let let
p = config.elars.theme.palette.withHashtag; p = config.elars.theme.palette;
toHex2 =
n:
let
h = lib.toLower (lib.toHexString n);
in
if n < 16 then "0${h}" else h;
clamp = n: lib.max 0 (lib.min 255 n);
tone =
sat: bright: hex:
let
rgb = config.elars.theme.hexToRgb hex;
r = builtins.elemAt rgb 0;
g = builtins.elemAt rgb 1;
b = builtins.elemAt rgb 2;
y = (299 * r + 587 * g + 114 * b) / 1000;
ch = c: clamp ((y * 100 + (c - y) * sat) / 100 * bright / 100);
in
"#${toHex2 (ch r)}${toHex2 (ch g)}${toHex2 (ch b)}";
surface = tone 100 80;
dim = tone 100 95;
text = tone 100 92;
hue = tone 60 88;
in in
{ {
programs.ghostty.settings = { programs.ghostty.settings = {
background = p.base00; background = surface p.base00;
foreground = p.base05; foreground = text p.base05;
cursor-color = hue p.accent;
cursor-color = p.accent; cursor-text = surface p.base00;
cursor-text = p.base00; selection-background = surface p.base02;
selection-foreground = text p.base05;
selection-background = p.base02;
selection-foreground = p.base05;
palette = [ palette = [
"0=${p.base00}" "0=${surface p.base00}"
"1=${p.base08}" "1=${hue p.base08}"
"2=${p.base0B}" "2=${hue p.base0B}"
"3=${p.base0A}" "3=${hue p.base0A}"
"4=${p.base0D}" "4=${hue p.base0D}"
"5=${p.base0E}" "5=${hue p.base0E}"
"6=${p.base0C}" "6=${hue p.base0C}"
"7=${p.base05}" "7=${text p.base05}"
"8=${p.base03}" "8=${dim p.base03}"
"9=${p.base08}" "9=${hue p.base08}"
"10=${p.base0B}" "10=${hue p.base0B}"
"11=${p.base09}" "11=${hue p.base09}"
"12=${p.base0D}" "12=${hue p.base0D}"
"13=${p.base0E}" "13=${hue p.base0E}"
"14=${p.base0C}" "14=${hue p.base0C}"
"15=${p.base07}" "15=${text p.base07}"
]; ];
}; };
}; };