1

Color: Add catppuccin latte and mocha schemes

This commit is contained in:
2024-10-13 16:07:26 +02:00
parent a04a7d7d7d
commit 94d2ff1ebb
6 changed files with 197 additions and 12 deletions

View File

@ -38,6 +38,12 @@ rec {
google = false;
};
color = {
enable = true; # You can't disable this
lightScheme = "catppuccin-latte";
darkScheme = "catppuccin-mocha";
};
firefox = {
enable = true;
wayland = true;

View File

@ -0,0 +1,29 @@
{
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 = "";
}

View File

@ -1,5 +1,29 @@
{
rosewater = {
hex = "#dc8a78";
};
rosewater = "dc8a78";
flamingo = "dd7878";
pink = "ea76cb";
mauve = "8839ef";
red = "d20f39";
maroon = "e64553";
peach = "fe640b";
yellow = "df8e1d";
green = "40a02b";
teal = "179299";
sky = "04a5e5";
sapphire = "209fb5";
blue = "1e66f5";
lavender = "7287fd";
text = "4c4f69";
subtext1 = "5c5f77";
subtext0 = "6c6f85";
overlay2 = "7c7f93";
overlay1 = "8c8fa1";
overlay0 = "9ca0b0";
surface2 = "acb0be";
surface1 = "bcc0cc";
surface0 = "ccd0da";
base = "eff1f5";
mantle = "e6e9ef";
crust = "dce0e8";
}

View File

@ -0,0 +1,29 @@
{
rosewater = "f5e0dc";
flamingo = "f2cdcd";
pink = "f5c2e7";
mauve = "cba6f7";
red = "f38ba8";
maroon = "eba0ac";
peach = "fab387";
yellow = "f9e2af";
green = "a6e3a1";
teal = "94e2d5";
sky = "89dceb";
sapphire = "74c7ec";
blue = "89b4fa";
lavender = "b4befe";
text = "cdd6f4";
subtext1 = "bac2de";
subtext0 = "a6adc8";
overlay2 = "9399b2";
overlay1 = "7f849c";
overlay0 = "6c7086";
surface2 = "585b70";
surface1 = "45475a";
surface0 = "313244";
base = "1e1e2e";
mantle = "181825";
crust = "11111b";
}

View File

@ -7,8 +7,60 @@
with lib;
with mylib.modules; let
cfg = config.modules.color;
in {
options.modules.color = import ./options.nix {inherit lib mylib;};
config = {};
# Options and assignments will be generated from those keys
colorKeys = [
# Colors
"rosewater"
"flamingo"
"pink"
"mauve"
"red"
"maroon"
"peach"
"yellow"
"green"
"teal"
"sky"
"sapphire"
"blue"
"lavender"
# 50 shades of gray
"text"
"subtext1"
"subtext0"
"overlay2"
"overlay1"
"overlay0"
"surface2"
"surface1"
"surface0"
"base"
"mantle"
"crust"
];
in {
options.modules.color = import ./options.nix {inherit lib mylib colorKeys;};
config = let
lightDefs = import ./${cfg.lightScheme}.nix;
darkDefs = import ./${cfg.darkScheme}.nix;
mkLightColorAssignment = key: {${key} = lightDefs.${key};};
mkDarkColorAssignment = key: {${key} = darkDefs.${key};};
in
mkIf cfg.enable {
# This module sets its own options
# to the values specified in a colorscheme file.
modules.color.light = lib.pipe colorKeys [
(builtins.map mkLightColorAssignment)
lib.mergeAttrsList
];
modules.color.dark = lib.pipe colorKeys [
(builtins.map mkDarkColorAssignment)
lib.mergeAttrsList
];
};
}

View File

@ -1,13 +1,58 @@
{
lib,
mylib,
colorKeys,
...
}:
with lib;
with mylib.modules; {
scheme = mkOption {
type = types.str;
description = "The color scheme to use";
example = "catppuccin-latte";
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";
};
};
}
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";
};
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";
};
dark = mkOption {
type = types.attrs;
description = "Colors belonging to the selected dark scheme";
};
}