plugins/base16: add customColorScheme option

This commit is contained in:
Gaetan Lepage 2023-08-08 16:18:30 +02:00 committed by Gaétan Lepage
parent d024526420
commit 9349da2714
2 changed files with 94 additions and 0 deletions

View file

@ -32,6 +32,53 @@ in {
default = true;
description = "Whether to install the matching plugin for your statusbar. This does nothing as of yet, waiting for upstream support.";
};
customColorScheme =
helpers.mkNullOrOption
(with types;
submodule {
options =
listToAttrs
(
map
(
colorId: rec {
name = "base0" + colorId;
value = mkOption {
type = types.str;
description = "The value for color ${name}.";
example = "#16161D";
};
}
)
["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"]
);
})
''
Optionaly, you can provide a table specifying your colors to the setup function.
Example:
```nix
{
base00 = "#16161D";
base01 = "#2c313c";
base02 = "#3e4451";
base03 = "#6c7891";
base04 = "#565c64";
base05 = "#abb2bf";
base06 = "#9a9bb3";
base07 = "#c5c8e6";
base08 = "#e06c75";
base09 = "#d19a66";
base0A = "#e5c07b";
base0B = "#98c379";
base0C = "#56b6c2";
base0D = "#0184bc";
base0E = "#c678dd";
base0F = "#a06949";
}
```
'';
};
};
@ -43,5 +90,9 @@ in {
plugins.lightline.colorscheme = null;
options.termguicolors = mkIf cfg.useTruecolor true;
extraConfigLua = mkIf (cfg.customColorScheme != null) ''
require('base16-colorscheme').setup(${helpers.toLuaObject cfg.customColorScheme})
'';
};
}

View file

@ -0,0 +1,43 @@
{
# Empty configuration
empty = {
colorschemes.base16.enable = true;
};
# All the upstream default options of poimandres
defaults = {
colorschemes.base16 = {
enable = true;
useTruecolor = true;
colorscheme = "gruvbox-dark-hard";
setUpBar = true;
customColorScheme = null;
};
};
custom-colors = {
colorschemes.base16 = {
enable = true;
customColorScheme = {
base00 = "#16161D";
base01 = "#2c313c";
base02 = "#3e4451";
base03 = "#6c7891";
base04 = "#565c64";
base05 = "#abb2bf";
base06 = "#9a9bb3";
base07 = "#c5c8e6";
base08 = "#e06c75";
base09 = "#d19a66";
base0A = "#e5c07b";
base0B = "#98c379";
base0C = "#56b6c2";
base0D = "#0184bc";
base0E = "#c678dd";
base0F = "#a06949";
};
};
};
}