yep, more dotfiles
1{ config 2, lib 3, ... 4}: 5 6let 7 cfg = config.colorScheme; 8 9 hexColorType = with lib; mkOptionType { 10 name = "hex-color"; 11 descriptionClass = "noun"; 12 description = "RGB color in hex format"; 13 check = x: isString x && !(hasPrefix "#" x); 14 }; 15in 16{ 17 options.local.colorScheme = with lib; { 18 slug = mkOption { 19 type = types.str; 20 example = "awesome-scheme"; 21 description = '' 22 Color scheme slug (sanitized name) 23 ''; 24 }; 25 name = mkOption { 26 type = types.str; 27 default = ""; 28 example = "Awesome Scheme"; 29 description = '' 30 Color scheme (pretty) name 31 ''; 32 }; 33 description = mkOption { 34 type = types.str; 35 default = ""; 36 example = "A very nice theme"; 37 description = '' 38 Color scheme author 39 ''; 40 }; 41 author = mkOption { 42 type = types.str; 43 default = ""; 44 example = "Gabriel Fontes (https://m7.rs)"; 45 description = '' 46 Color scheme author 47 ''; 48 }; 49 variant = mkOption { 50 type = types.enum [ "dark" "light" ]; 51 default = 52 if builtins.substring 0 1 cfg.palette.base00 < "5" then 53 "dark" 54 else 55 "light"; 56 description = '' 57 Whether the scheme is dark or light 58 ''; 59 }; 60 61 palette = mkOption { 62 type = with types; attrsOf ( 63 coercedTo str (removePrefix "#") hexColorType 64 ); 65 default = { }; 66 example = literalExpression '' 67 { 68 base00 = "002635"; 69 base01 = "00384d"; 70 base02 = "517F8D"; 71 base03 = "6C8B91"; 72 base04 = "869696"; 73 base05 = "a1a19a"; 74 base06 = "e6e6dc"; 75 base07 = "fafaf8"; 76 base08 = "ff5a67"; 77 base09 = "f08e48"; 78 base0A = "ffcc1b"; 79 base0B = "7fc06e"; 80 base0C = "14747e"; 81 base0D = "5dd7b9"; 82 base0E = "9a70a4"; 83 base0F = "c43060"; 84 } 85 ''; 86 description = '' 87 Atribute set of hex colors. 88 89 These are usually base00-base0F, but you may use any name you want. 90 For example, these can have meaningful names (bg, fg), or be base24. 91 92 The colorschemes provided by nix-colors follow the base16 standard. 93 Some might leverage base24 and have 24 colors, but these can be safely 94 used as if they were base16. 95 96 You may include a leading #, but it will be stripped when accessed from 97 config.colorscheme.palette. 98 ''; 99 }; 100 }; 101}