colorschemes/catpuccin: fix type for option colorOverrides

This commit is contained in:
Gaetan Lepage 2023-07-12 09:30:23 +02:00 committed by Gaétan Lepage
parent 0d2a436255
commit 22306af9aa
2 changed files with 66 additions and 30 deletions

View file

@ -7,6 +7,13 @@
with lib; let with lib; let
cfg = config.colorschemes.catppuccin; cfg = config.colorschemes.catppuccin;
helpers = import ../helpers.nix args; helpers = import ../helpers.nix args;
flavours = [
"latte"
"mocha"
"frappe"
"macchiato"
];
in { in {
options = { options = {
colorschemes.catppuccin = { colorschemes.catppuccin = {
@ -15,21 +22,11 @@ in {
package = package =
helpers.mkPackageOption "catppuccin" pkgs.vimPlugins.catppuccin-nvim; helpers.mkPackageOption "catppuccin" pkgs.vimPlugins.catppuccin-nvim;
flavour = helpers.defaultNullOpts.mkEnumFirstDefault [ flavour = helpers.defaultNullOpts.mkEnumFirstDefault flavours "Theme flavour";
"latte"
"mocha"
"frappe"
"macchiato"
] "Theme flavour";
background = let background = let
mkBackgroundStyle = name: mkBackgroundStyle = name:
helpers.defaultNullOpts.mkEnumFirstDefault [ helpers.defaultNullOpts.mkEnumFirstDefault flavours "Background for ${name}";
"latte"
"mocha"
"frappe"
"macchiato"
] "Background for ${name}";
in { in {
light = mkBackgroundStyle "light"; light = mkBackgroundStyle "light";
dark = mkBackgroundStyle "dark"; dark = mkBackgroundStyle "dark";
@ -115,23 +112,20 @@ in {
"Define operators highlight properties"; "Define operators highlight properties";
}; };
colorOverrides = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) "{}" '' colorOverrides =
Define color overrides genAttrs
Example: (flavours ++ ["all"])
color_overrides = { (
all = { flavour:
text = "#ffffff", helpers.defaultNullOpts.mkNullable
}, (with types; attrsOf str)
latte = { "{}"
base = "#ff0000", (
mantle = "#242424", if flavour == "all"
crust = "#474747", then "Override colors for all of the flavours."
}, else "Override colors for the ${flavour} flavour."
frappe = {}, )
macchiato = {}, );
mocha = {},
}
'';
customHighlights = customHighlights =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable

View file

@ -1,6 +1,8 @@
{ {
# Empty configuration # Empty configuration
empty = {colorschemes.catppuccin.enable = true;}; empty = {
colorschemes.catppuccin.enable = true;
};
# All the upstream default options of poimandres # All the upstream default options of poimandres
defaults = { defaults = {
@ -47,4 +49,44 @@
}; };
}; };
}; };
example = {
colorschemes.catppuccin = {
enable = true;
flavour = "mocha";
terminalColors = true;
colorOverrides.mocha.base = "#1e1e2f";
integrations = {
barbar = true;
fidget = true;
gitsigns = true;
illuminate = true;
indent_blankline = {
enabled = true;
colored_indent_levels = true;
};
lsp_trouble = true;
mini = true;
native_lsp.enabled = true;
navic.enabled = true;
nvimtree = true;
overseer = true;
telescope = true;
treesitter = true;
treesitter_context = true;
ts_rainbow2 = true;
};
styles = {
booleans = ["bold" "italic"];
conditionals = ["bold"];
functions = ["bold"];
keywords = ["italic"];
loops = ["bold"];
operators = ["bold"];
properties = ["italic"];
};
};
};
} }