1

Color: Don't generate unnecessary sub-options

This commit is contained in:
2024-10-14 20:29:23 +02:00
parent 506a2b833a
commit 0a39fe41f9

View File

@ -5,71 +5,53 @@
...
}:
with lib;
with mylib.modules; let
mkColorOption = key: {
light.${key} = mkOption {
type = types.str;
description = "The RGB hex color value for ${key} in the light scheme";
example = "EEEEEE";
};
dark.${key} = mkOption {
type = types.str;
description = "The RGB hex color value for ${key} in the dark scheme";
example = "111111";
};
with mylib.modules; {
enable = mkEnableOption "Enable color schemes";
lightScheme = mkOption {
type = types.str;
description = "The color scheme to use for light colors";
example = "catppuccin-latte";
default = "catppuccin-latte";
};
in
(lib.pipe colorKeys [
(builtins.map mkColorOption)
lib.mergeAttrsList
])
// {
enable = mkEnableOption "Enable color schemes";
lightScheme = mkOption {
type = types.str;
description = "The color scheme to use for light colors";
example = "catppuccin-latte";
default = "catppuccin-latte";
};
darkScheme = mkOption {
type = types.str;
description = "The color scheme to use for dark colors";
example = "catppuccin-mocha";
default = "catppuccin-mocha";
};
darkScheme = mkOption {
type = types.str;
description = "The color scheme to use for dark colors";
example = "catppuccin-mocha";
default = "catppuccin-mocha";
};
font = mkOption {
type = types.str;
description = "The font to use";
example = "JetBrainsMono Nerd Font Mono";
default = "JetBrainsMono Nerd Font Mono";
};
font = mkOption {
type = types.str;
description = "The font to use";
example = "JetBrainsMono Nerd Font Mono";
default = "JetBrainsMono Nerd Font Mono";
};
keys = mkOption {
type = types.listOf types.str;
description = "The names of all possible colors";
default = colorKeys;
};
keys = mkOption {
type = types.listOf types.str;
description = "The names of all possible colors";
default = colorKeys;
};
light = mkOption {
type = types.attrs;
description = "Colors belonging to the selected light scheme";
};
light = mkOption {
type = types.attrs;
description = "Colors belonging to the selected light scheme";
};
dark = mkOption {
type = types.attrs;
description = "Colors belonging to the selected dark scheme";
};
dark = mkOption {
type = types.attrs;
description = "Colors belonging to the selected dark scheme";
};
rgbString = mkOption {
type = types.attrs;
description = "Colors belonging to the selected light scheme in 'RR,GG,BB' format";
};
rgbString = mkOption {
type = types.attrs;
description = "Colors belonging to the selected light scheme in 'RR,GG,BB' format";
};
rgb = mkOption {
type = types.attrs;
description = "Colors belonging to the selected light scheme in '[RR GG BB]' format";
};
}
rgb = mkOption {
type = types.attrs;
description = "Colors belonging to the selected light scheme in '[RR GG BB]' format";
};
}