qol(base16): hex to rgb possible
This commit is contained in:
@@ -12,107 +12,34 @@
|
||||
# author: "Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox)"
|
||||
# variant: "dark"
|
||||
let
|
||||
cfg_hex = {
|
||||
"01" = "#1d2021"; # base00
|
||||
"02" = "#3c3836"; # base01
|
||||
"03" = "#504945"; # base02
|
||||
"04" = "#665c54"; # base03
|
||||
"05" = "#bdae93"; # base04
|
||||
"06" = "#d5c4a1"; # base05
|
||||
"07" = "#ebdbb2"; # base06
|
||||
"08" = "#fbf1c7"; # base07
|
||||
"09" = "#fb4934"; # base08 (red)
|
||||
"10" = "#fe8019"; # base09 (orange)
|
||||
"11" = "#fabd2f"; # base0A (yellow)
|
||||
"12" = "#b8bb26"; # base0B (green)
|
||||
"13" = "#8ec07c"; # base0C (aqua/cyan)
|
||||
"14" = "#83a598"; # base0D (blue)
|
||||
"15" = "#d3869b"; # base0E (purple)
|
||||
"16" = "#d65d0e"; # base0F (brown)
|
||||
};
|
||||
|
||||
cfg_rgb = {
|
||||
"01" = {
|
||||
r = 29;
|
||||
g = 32;
|
||||
b = 33;
|
||||
}; # base00
|
||||
"02" = {
|
||||
r = 60;
|
||||
g = 56;
|
||||
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)
|
||||
hexToInt = hex: fromTOML "value = 0x${hex}";
|
||||
hexToRgb =
|
||||
hex:
|
||||
let
|
||||
red = hexToInt (builtins.substring 1 2 hex);
|
||||
green = hexToInt (builtins.substring 3 2 hex);
|
||||
blue = hexToInt (builtins.substring 5 2 hex);
|
||||
in
|
||||
{
|
||||
r = red.value;
|
||||
g = green.value;
|
||||
b = blue.value;
|
||||
};
|
||||
theme =
|
||||
let
|
||||
importYaml =
|
||||
file:
|
||||
builtins.fromJSON (
|
||||
builtins.readFile (
|
||||
pkgs.runCommandNoCC "converted-yaml.json" { } ''
|
||||
${pkgs.yj}/bin/yj < ${file} > $out
|
||||
''
|
||||
)
|
||||
);
|
||||
# EDIT THEME HERE
|
||||
themeFile = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
|
||||
in
|
||||
importYaml themeFile;
|
||||
in
|
||||
{
|
||||
options.modules.base16 = {
|
||||
@@ -121,17 +48,15 @@ in
|
||||
description = ''
|
||||
Hexadecimal color configuration for Gruvbox dark, hard Base16 theme.
|
||||
'';
|
||||
default = cfg_hex;
|
||||
};
|
||||
rgb = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
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.rgb = cfg_rgb;
|
||||
config.modules.base16.hex = theme.palette;
|
||||
config.modules.base16.rgb = builtins.mapAttrs (_name: hex: hexToRgb hex) theme.palette;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,9 @@ in
|
||||
gaps_out = 1;
|
||||
border_size = 1;
|
||||
"col.active_border" =
|
||||
"rgb(${toString base16.rgb."06".r},${toString base16.rgb."06".g},${toString base16.rgb."06".b})";
|
||||
# col.inactive_border = rgba(595959aa)
|
||||
"rgb(${toString base16.rgb."base06".r},${toString base16.rgb."base06".g},${toString base16.rgb."base06".b})";
|
||||
"col.inactive_border" =
|
||||
"rgb(${toString base16.rgb."base03".r},${toString base16.rgb."base03".g},${toString base16.rgb."base03".b})";
|
||||
resize_on_border = false;
|
||||
allow_tearing = true;
|
||||
layout = "dwindle";
|
||||
@@ -68,19 +69,19 @@ in
|
||||
"global, 1, 10, default"
|
||||
"border, 1, 5.39, easeOutQuint"
|
||||
"windows, 1, 2.79, easeOutQuint"
|
||||
"windowsIn, 1, 1.1, easeOutQuint, popin 87%"
|
||||
"windowsOut, 1, 1.49, linear, popin 87%"
|
||||
"fadeIn, 1, 1.73, almostLinear"
|
||||
"fadeOut, 1, 1.46, almostLinear"
|
||||
"fade, 1, 2.03, quick"
|
||||
"windowsIn, 1, 0.8, easeOutQuint, popin 87%"
|
||||
"windowsOut, 1, 1, linear, popin 87%"
|
||||
"fadeIn, 1, 0.5, almostLinear"
|
||||
"fadeOut, 1, 0.5, almostLinear"
|
||||
"fade, 1, 1, quick"
|
||||
"layers, 1, 3.81, easeOutQuint"
|
||||
"layersIn, 1, 4, easeOutQuint, fade"
|
||||
"layersOut, 1, 1.5, linear, fade"
|
||||
"fadeLayersIn, 1, 1.79, almostLinear"
|
||||
"fadeLayersOut, 1, 1.39, almostLinear"
|
||||
"workspaces, 1, 1.94, almostLinear, fade"
|
||||
"workspacesIn, 1, 1.21, almostLinear, fade"
|
||||
"workspacesOut, 1, 1.94, almostLinear, fade"
|
||||
"workspaces, 1, 1, almostLinear, fade"
|
||||
"workspacesIn, 1, 0.7, almostLinear, fade"
|
||||
"workspacesOut, 1, 0.6, almostLinear, fade"
|
||||
"zoomFactor, 1, 7, quick"
|
||||
];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user