qol(base16): hex to rgb possible

This commit is contained in:
2026-01-11 01:54:56 +01:00
parent 9151cb04eb
commit 57dfdc2cab
2 changed files with 42 additions and 116 deletions

View File

@@ -12,107 +12,34 @@
# author: "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)" # author: "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)"
# variant: "dark" # variant: "dark"
let let
cfg_hex = { hexToInt = hex: fromTOML "value = 0x${hex}";
"01" = "#1d2021"; # base00 hexToRgb =
"02" = "#3c3836"; # base01 hex:
"03" = "#504945"; # base02 let
"04" = "#665c54"; # base03 red = hexToInt (builtins.substring 1 2 hex);
"05" = "#bdae93"; # base04 green = hexToInt (builtins.substring 3 2 hex);
"06" = "#d5c4a1"; # base05 blue = hexToInt (builtins.substring 5 2 hex);
"07" = "#ebdbb2"; # base06 in
"08" = "#fbf1c7"; # base07 {
"09" = "#fb4934"; # base08 (red) r = red.value;
"10" = "#fe8019"; # base09 (orange) g = green.value;
"11" = "#fabd2f"; # base0A (yellow) b = blue.value;
"12" = "#b8bb26"; # base0B (green) };
"13" = "#8ec07c"; # base0C (aqua/cyan) theme =
"14" = "#83a598"; # base0D (blue) let
"15" = "#d3869b"; # base0E (purple) importYaml =
"16" = "#d65d0e"; # base0F (brown) file:
}; builtins.fromJSON (
builtins.readFile (
cfg_rgb = { pkgs.runCommandNoCC "converted-yaml.json" { } ''
"01" = { ${pkgs.yj}/bin/yj < ${file} > $out
r = 29; ''
g = 32; )
b = 33; );
}; # base00 # EDIT THEME HERE
"02" = { themeFile = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
r = 60; in
g = 56; importYaml themeFile;
b = 54;
}; # base01
"03" = {
r = 80;
g = 73;
b = 69;
}; # base02
"04" = {
r = 102;
g = 92;
b = 84;
}; # base03
"05" = {
r = 189;
g = 174;
b = 147;
}; # base04
"06" = {
r = 213;
g = 196;
b = 161;
}; # base05
"07" = {
r = 235;
g = 219;
b = 178;
}; # base06
"08" = {
r = 251;
g = 241;
b = 199;
}; # base07
"09" = {
r = 251;
g = 73;
b = 52;
}; # base08 (red)
"10" = {
r = 254;
g = 128;
b = 25;
}; # base09 (orange)
"11" = {
r = 250;
g = 189;
b = 47;
}; # base0A (yellow)
"12" = {
r = 184;
g = 187;
b = 38;
}; # base0B (green)
"13" = {
r = 142;
g = 192;
b = 124;
}; # base0C (aqua/cyan)
"14" = {
r = 131;
g = 165;
b = 152;
}; # base0D (blue)
"15" = {
r = 211;
g = 134;
b = 155;
}; # base0E (purple)
"16" = {
r = 214;
g = 93;
b = 14;
}; # base0F (brown)
};
in in
{ {
options.modules.base16 = { options.modules.base16 = {
@@ -121,17 +48,15 @@ in
description = '' description = ''
Hexadecimal color configuration for Gruvbox dark, hard Base16 theme. Hexadecimal color configuration for Gruvbox dark, hard Base16 theme.
''; '';
default = cfg_hex;
}; };
rgb = lib.mkOption { rgb = lib.mkOption {
type = lib.types.attrs; type = lib.types.attrs;
description = '' description = ''
RGB color configuration for Gruvbox dark, hard Base16 theme. Hexadecimal color configuration for Gruvbox dark, hard Base16 theme.
''; '';
default = cfg_rgb;
}; };
}; };
config.modules.base16.hex = cfg_hex; config.modules.base16.hex = theme.palette;
config.modules.base16.rgb = cfg_rgb; config.modules.base16.rgb = builtins.mapAttrs (_name: hex: hexToRgb hex) theme.palette;
} }

View File

@@ -32,8 +32,9 @@ in
gaps_out = 1; gaps_out = 1;
border_size = 1; border_size = 1;
"col.active_border" = "col.active_border" =
"rgb(${toString base16.rgb."06".r},${toString base16.rgb."06".g},${toString base16.rgb."06".b})"; "rgb(${toString base16.rgb."base06".r},${toString base16.rgb."base06".g},${toString base16.rgb."base06".b})";
# col.inactive_border = rgba(595959aa) "col.inactive_border" =
"rgb(${toString base16.rgb."base03".r},${toString base16.rgb."base03".g},${toString base16.rgb."base03".b})";
resize_on_border = false; resize_on_border = false;
allow_tearing = true; allow_tearing = true;
layout = "dwindle"; layout = "dwindle";
@@ -68,19 +69,19 @@ in
"global, 1, 10, default" "global, 1, 10, default"
"border, 1, 5.39, easeOutQuint" "border, 1, 5.39, easeOutQuint"
"windows, 1, 2.79, easeOutQuint" "windows, 1, 2.79, easeOutQuint"
"windowsIn, 1, 1.1, easeOutQuint, popin 87%" "windowsIn, 1, 0.8, easeOutQuint, popin 87%"
"windowsOut, 1, 1.49, linear, popin 87%" "windowsOut, 1, 1, linear, popin 87%"
"fadeIn, 1, 1.73, almostLinear" "fadeIn, 1, 0.5, almostLinear"
"fadeOut, 1, 1.46, almostLinear" "fadeOut, 1, 0.5, almostLinear"
"fade, 1, 2.03, quick" "fade, 1, 1, quick"
"layers, 1, 3.81, easeOutQuint" "layers, 1, 3.81, easeOutQuint"
"layersIn, 1, 4, easeOutQuint, fade" "layersIn, 1, 4, easeOutQuint, fade"
"layersOut, 1, 1.5, linear, fade" "layersOut, 1, 1.5, linear, fade"
"fadeLayersIn, 1, 1.79, almostLinear" "fadeLayersIn, 1, 1.79, almostLinear"
"fadeLayersOut, 1, 1.39, almostLinear" "fadeLayersOut, 1, 1.39, almostLinear"
"workspaces, 1, 1.94, almostLinear, fade" "workspaces, 1, 1, almostLinear, fade"
"workspacesIn, 1, 1.21, almostLinear, fade" "workspacesIn, 1, 0.7, almostLinear, fade"
"workspacesOut, 1, 1.94, almostLinear, fade" "workspacesOut, 1, 0.6, almostLinear, fade"
"zoomFactor, 1, 7, quick" "zoomFactor, 1, 7, quick"
]; ];
}; };