style: move colorscheme settings
This commit is contained in:
parent
dcdb4235ea
commit
47ed783712
6 changed files with 105 additions and 106 deletions
|
@ -1 +1,105 @@
|
|||
_: {}
|
||||
# NOTE: This module is entirely inspired by raf,
|
||||
# most of the nix code is also taken from him,
|
||||
# so please do check out his configuration!
|
||||
# raf himself took it from misterio77
|
||||
# and adapted it for his personal use,
|
||||
# so look there too.
|
||||
# <https://github.com/Misterio77/nix-colors/blob/main/module/colorscheme.nix>
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption literalExpression;
|
||||
inherit (lib.types) str nullOr enum mkOptionType attrsOf coercedTo;
|
||||
inherit (lib.strings) toLower replaceStrings removePrefix hasPrefix isString;
|
||||
# inherit (lib) serializeTheme;
|
||||
|
||||
cfg = config.modules.style;
|
||||
|
||||
hexColorType = mkOptionType {
|
||||
name = "hex-color";
|
||||
descriptionClass = "noun";
|
||||
description = "RGB color in hex format";
|
||||
check = x: isString x && !(hasPrefix "#" x);
|
||||
};
|
||||
colorType = attrsOf (coercedTo str (removePrefix "#") hexColorType);
|
||||
|
||||
nameToSlug = name: toLower (replaceStrings [" "] ["-"] name);
|
||||
getPaletteFromScheme = slug:
|
||||
if builtins.pathExists ./palettes/${slug}.nix
|
||||
then (import ./palettes/${slug}.nix).colorscheme.palette
|
||||
else throw "The following colorscheme was imported but not found: ${slug}";
|
||||
in {
|
||||
options.modules.style = {
|
||||
colorScheme = {
|
||||
name = mkOption {
|
||||
type = nullOr (enum ["Catppuccin Mocha" "Zenburn" "Black Metal Venom" "Gruvbox"]);
|
||||
description = "The colorscheme that should be used globally to theme your system.";
|
||||
default = "Gruvbox";
|
||||
};
|
||||
|
||||
slug = mkOption {
|
||||
type = str;
|
||||
default = nameToSlug "${toString cfg.colorScheme.name}"; # toString to avoid type errors if null, returns ""
|
||||
description = ''
|
||||
The serialized slug for the colorScheme you are using.
|
||||
|
||||
Defaults to a lowercased version of the theme name with spaces
|
||||
replaced with hyphens.
|
||||
|
||||
Must only be changed if the slug is expected to be different than
|
||||
the serialized theme name."
|
||||
'';
|
||||
};
|
||||
|
||||
colors = mkOption {
|
||||
type = colorType;
|
||||
default = getPaletteFromScheme cfg.colorScheme.slug;
|
||||
description = ''
|
||||
An attribute set containing active colors of the system. Follows base16
|
||||
scheme by default but can be expanded to base24 or anything "above" as
|
||||
seen fit as the module option is actually not checked in any way
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
base00 = "#1e1e2e"; # Base
|
||||
base01 = "#181825"; # Mantle
|
||||
base02 = "#313244"; # Surface0
|
||||
base03 = "#45475a"; # Surface1
|
||||
base04 = "#585b70"; # Surface2
|
||||
base05 = "#cdd6f4"; # text
|
||||
base06 = "#f5e0dc"; # rosewater
|
||||
base07 = "#b4befe"; # lavender
|
||||
base08 = "#f38ba8"; # red
|
||||
base09 = "#fab387"; # peach
|
||||
base0A = "#a6e3a1"; # yellow
|
||||
base0B = "#94e2d5"; # green
|
||||
base0C = "#94e2d5"; # teal
|
||||
base0D = "#89b4fa"; # blue
|
||||
base0E = "#cba6f7"; # mauve
|
||||
base0F = "#f2cdcd"; # flamingo
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
variant = mkOption {
|
||||
type = enum ["dark" "light"];
|
||||
default =
|
||||
if builtins.substring 0 1 cfg.colorScheme.colors.base00 < "5"
|
||||
then "dark"
|
||||
else "light";
|
||||
description = ''
|
||||
Whether the scheme is dark or light
|
||||
'';
|
||||
};
|
||||
alpha = mkOption {
|
||||
type = str;
|
||||
default = 1.0;
|
||||
description = ''
|
||||
The alpha value for the colorscheme
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
26
modules/style/palettes/black-metal-venom.nix
Normal file
26
modules/style/palettes/black-metal-venom.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
# author: "metalelf0 (https://github.com/metalelf0)"
|
||||
{
|
||||
colorscheme = {
|
||||
slug = "black-metal-venom";
|
||||
name = "Black Metal Venom";
|
||||
variant = "dark";
|
||||
palette = {
|
||||
base00 = "#000000";
|
||||
base01 = "#121212";
|
||||
base02 = "#222222";
|
||||
base03 = "#333333";
|
||||
base04 = "#999999";
|
||||
base05 = "#c1c1c1";
|
||||
base06 = "#999999";
|
||||
base07 = "#c1c1c1";
|
||||
base08 = "#5f8787";
|
||||
base09 = "#aaaaaa";
|
||||
base0A = "#79241f";
|
||||
base0B = "#f8f7f2";
|
||||
base0C = "#aaaaaa";
|
||||
base0D = "#888888";
|
||||
base0E = "#999999";
|
||||
base0F = "#444444";
|
||||
};
|
||||
};
|
||||
}
|
25
modules/style/palettes/catppuccin-mocha.nix
Normal file
25
modules/style/palettes/catppuccin-mocha.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
colorscheme = {
|
||||
slug = "catppuccin-mocha";
|
||||
name = "Catppuccin Mocha";
|
||||
variant = "dark";
|
||||
palette = {
|
||||
base00 = "#1e1e2e"; # Base
|
||||
base01 = "#181825"; # Mantle
|
||||
base02 = "#313244"; # Surface0
|
||||
base03 = "#45475a"; # Surface1
|
||||
base04 = "#585b70"; # Surface2
|
||||
base05 = "#cdd6f4"; # text
|
||||
base06 = "#f5e0dc"; # rosewater
|
||||
base07 = "#b4befe"; # lavender
|
||||
base08 = "#f38ba8"; # red
|
||||
base09 = "#fab387"; # peach
|
||||
base0A = "#a6e3a1"; # yellow
|
||||
base0B = "#94e2d5"; # green
|
||||
base0C = "#a6e3a1"; # teal
|
||||
base0D = "#89b4fa"; # blue
|
||||
base0E = "#cba6f7"; # mauve
|
||||
base0F = "#f2cdcd"; # flamingo
|
||||
};
|
||||
};
|
||||
}
|
25
modules/style/palettes/gruvbox.nix
Normal file
25
modules/style/palettes/gruvbox.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
colorscheme = {
|
||||
slug = "gruvbox";
|
||||
name = "Gruvbox";
|
||||
variant = "dark";
|
||||
palette = {
|
||||
base00 = "#282828"; # ----
|
||||
base01 = "#3c3836"; # ---
|
||||
base02 = "#504945"; # --
|
||||
base03 = "#665c54"; # -
|
||||
base04 = "#bdae93"; # +
|
||||
base05 = "#d5c4a1"; # ++
|
||||
base06 = "#ebdbb2"; # +++
|
||||
base07 = "#fbf1c7"; # ++++
|
||||
base08 = "#fb4934"; # red
|
||||
base09 = "#fe8019"; # orange
|
||||
base0A = "#fabd2f"; # yellow
|
||||
base0B = "#b8bb26"; # green
|
||||
base0C = "#8ec07c"; # aqua/cyan
|
||||
base0D = "#83a598"; # blue
|
||||
base0E = "#d3869b"; # purple
|
||||
base0F = "#d65d0e"; # brown
|
||||
};
|
||||
};
|
||||
}
|
25
modules/style/palettes/zenburn.nix
Normal file
25
modules/style/palettes/zenburn.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
colorscheme = {
|
||||
slug = "zenburn";
|
||||
name = "Zenburn";
|
||||
variant = "dark";
|
||||
palette = {
|
||||
base00 = "#383838";
|
||||
base01 = "#404040";
|
||||
base02 = "#606060";
|
||||
base03 = "#6f6f6f";
|
||||
base04 = "#808080";
|
||||
base05 = "#dcdccc";
|
||||
base06 = "#c0c0c0";
|
||||
base07 = "#ffffff";
|
||||
base08 = "#dca3a3";
|
||||
base09 = "#afaf8f";
|
||||
base0A = "#e0cf9f";
|
||||
base0B = "#5f7f5f";
|
||||
base0C = "#93e0e3";
|
||||
base0D = "#7cb8bb";
|
||||
base0E = "#dc8cc3";
|
||||
base0F = "#000000";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue