Color: Add different color representations
RgbString: e.g. "24,155,213" Rgb: e.g. [24 155 213]
This commit is contained in:
@ -45,20 +45,47 @@ in {
|
|||||||
lightDefs = import ./schemes/${color.lightScheme}.nix;
|
lightDefs = import ./schemes/${color.lightScheme}.nix;
|
||||||
darkDefs = import ./schemes/${color.darkScheme}.nix;
|
darkDefs = import ./schemes/${color.darkScheme}.nix;
|
||||||
|
|
||||||
mkLightColorAssignment = key: {${key} = lightDefs.${key};};
|
mkColorAssignment = defs: key: {${key} = defs.${key};};
|
||||||
mkDarkColorAssignment = key: {${key} = darkDefs.${key};};
|
mkRgbColorAssignment = defs: key: {${key} = mylib.color.hexToRGB defs.${key};};
|
||||||
|
mkRgbStringColorAssignment = defs: key: {${key} = mylib.color.hexToRGBString "," defs.${key};};
|
||||||
in
|
in
|
||||||
lib.mkIf color.enable {
|
lib.mkIf color.enable {
|
||||||
# This module sets its own options
|
# This module sets its own options
|
||||||
# to the values specified in a colorscheme file.
|
# to the values specified in a colorscheme file.
|
||||||
modules.color.light = lib.pipe colorKeys [
|
modules.color = {
|
||||||
(builtins.map mkLightColorAssignment)
|
light = lib.pipe colorKeys [
|
||||||
|
(builtins.map (mkColorAssignment lightDefs))
|
||||||
lib.mergeAttrsList
|
lib.mergeAttrsList
|
||||||
];
|
];
|
||||||
|
|
||||||
modules.color.dark = lib.pipe colorKeys [
|
dark = lib.pipe colorKeys [
|
||||||
(builtins.map mkDarkColorAssignment)
|
(builtins.map (mkColorAssignment darkDefs))
|
||||||
|
lib.mergeAttrsList
|
||||||
|
];
|
||||||
|
|
||||||
|
rgb = {
|
||||||
|
light = lib.pipe colorKeys [
|
||||||
|
(builtins.map (mkRgbColorAssignment lightDefs))
|
||||||
|
lib.mergeAttrsList
|
||||||
|
];
|
||||||
|
|
||||||
|
dark = lib.pipe colorKeys [
|
||||||
|
(builtins.map (mkRgbColorAssignment darkDefs))
|
||||||
lib.mergeAttrsList
|
lib.mergeAttrsList
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rgbString = {
|
||||||
|
light = lib.pipe colorKeys [
|
||||||
|
(builtins.map (mkRgbStringColorAssignment lightDefs))
|
||||||
|
lib.mergeAttrsList
|
||||||
|
];
|
||||||
|
|
||||||
|
dark = lib.pipe colorKeys [
|
||||||
|
(builtins.map (mkRgbStringColorAssignment darkDefs))
|
||||||
|
lib.mergeAttrsList
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -62,4 +62,14 @@ in
|
|||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
description = "Colors belonging to the selected dark scheme";
|
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";
|
||||||
|
};
|
||||||
|
|
||||||
|
rgb = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
description = "Colors belonging to the selected light scheme in '[RR GG BB]' format";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user