Modules/Color: Add semantic color aliases
This commit is contained in:
@ -57,7 +57,18 @@ in {
|
|||||||
|
|
||||||
# This module sets its own options to the values specified in a colorscheme file.
|
# This module sets its own options to the values specified in a colorscheme file.
|
||||||
modules.color = let
|
modules.color = let
|
||||||
colorDefs = import ./schemes/${color.scheme}.nix;
|
scheme = import ./schemes/${color.scheme}.nix;
|
||||||
|
|
||||||
|
# Add the aliases
|
||||||
|
colorDefs =
|
||||||
|
scheme
|
||||||
|
// {
|
||||||
|
bg = scheme.${color.bg};
|
||||||
|
text = scheme.${color.text};
|
||||||
|
accent = scheme.${color.accent};
|
||||||
|
accentHL = scheme.${color.accentHL};
|
||||||
|
accentText = scheme.${color.accentText};
|
||||||
|
};
|
||||||
|
|
||||||
mkColorAssignment = key: {${key} = colorDefs.${key};};
|
mkColorAssignment = key: {${key} = colorDefs.${key};};
|
||||||
mkStringColorAssignment = key: {${key} = "#${colorDefs.${key}}";};
|
mkStringColorAssignment = key: {${key} = "#${colorDefs.${key}}";};
|
||||||
|
@ -2,7 +2,37 @@
|
|||||||
lib,
|
lib,
|
||||||
mylib,
|
mylib,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
colorKeys = [
|
||||||
|
"rosewater"
|
||||||
|
"flamingo"
|
||||||
|
"pink"
|
||||||
|
"mauve"
|
||||||
|
"red"
|
||||||
|
"maroon"
|
||||||
|
"peach"
|
||||||
|
"yellow"
|
||||||
|
"green"
|
||||||
|
"teal"
|
||||||
|
"sky"
|
||||||
|
"sapphire"
|
||||||
|
"blue"
|
||||||
|
"lavender"
|
||||||
|
|
||||||
|
"text"
|
||||||
|
"subtext1"
|
||||||
|
"subtext0"
|
||||||
|
"overlay2"
|
||||||
|
"overlay1"
|
||||||
|
"overlay0"
|
||||||
|
"surface2"
|
||||||
|
"surface1"
|
||||||
|
"surface0"
|
||||||
|
"base"
|
||||||
|
"mantle"
|
||||||
|
"crust"
|
||||||
|
];
|
||||||
|
in {
|
||||||
scheme = lib.mkOption {
|
scheme = lib.mkOption {
|
||||||
type = lib.types.enum [
|
type = lib.types.enum [
|
||||||
"catppuccin-latte"
|
"catppuccin-latte"
|
||||||
@ -41,4 +71,40 @@
|
|||||||
type = lib.types.attrs;
|
type = lib.types.attrs;
|
||||||
description = "Colors in \"RR,GG,BB\" decimal format";
|
description = "Colors in \"RR,GG,BB\" decimal format";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Some semantic aliases for colors
|
||||||
|
bg = lib.mkOption {
|
||||||
|
type = lib.types.enum colorKeys;
|
||||||
|
description = "The color to use as background";
|
||||||
|
example = "base";
|
||||||
|
default = "base";
|
||||||
|
};
|
||||||
|
|
||||||
|
text = lib.mkOption {
|
||||||
|
type = lib.types.enum colorKeys;
|
||||||
|
description = "The text color to use";
|
||||||
|
example = "text";
|
||||||
|
default = "text";
|
||||||
|
};
|
||||||
|
|
||||||
|
accent = lib.mkOption {
|
||||||
|
type = lib.types.enum colorKeys;
|
||||||
|
description = "The accent color to use";
|
||||||
|
example = "mauve";
|
||||||
|
default = "mauve";
|
||||||
|
};
|
||||||
|
|
||||||
|
accentHL = lib.mkOption {
|
||||||
|
type = lib.types.enum colorKeys;
|
||||||
|
description = "The accented accent color to use";
|
||||||
|
example = "pink";
|
||||||
|
default = "pink";
|
||||||
|
};
|
||||||
|
|
||||||
|
accentText = lib.mkOption {
|
||||||
|
type = lib.types.enum colorKeys;
|
||||||
|
description = "The text color to use for accents";
|
||||||
|
example = "base";
|
||||||
|
default = "base";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user