diff --git a/plugins/colorschemes/base16.nix b/plugins/colorschemes/base16.nix index e9620213..daa47d4d 100644 --- a/plugins/colorschemes/base16.nix +++ b/plugins/colorschemes/base16.nix @@ -32,6 +32,53 @@ in { default = true; description = "Whether to install the matching plugin for your statusbar. This does nothing as of yet, waiting for upstream support."; }; + + customColorScheme = + helpers.mkNullOrOption + (with types; + submodule { + options = + listToAttrs + ( + map + ( + colorId: rec { + name = "base0" + colorId; + value = mkOption { + type = types.str; + description = "The value for color ${name}."; + example = "#16161D"; + }; + } + ) + ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"] + ); + }) + '' + Optionaly, you can provide a table specifying your colors to the setup function. + + Example: + ```nix + { + base00 = "#16161D"; + base01 = "#2c313c"; + base02 = "#3e4451"; + base03 = "#6c7891"; + base04 = "#565c64"; + base05 = "#abb2bf"; + base06 = "#9a9bb3"; + base07 = "#c5c8e6"; + base08 = "#e06c75"; + base09 = "#d19a66"; + base0A = "#e5c07b"; + base0B = "#98c379"; + base0C = "#56b6c2"; + base0D = "#0184bc"; + base0E = "#c678dd"; + base0F = "#a06949"; + } + ``` + ''; }; }; @@ -43,5 +90,9 @@ in { plugins.lightline.colorscheme = null; options.termguicolors = mkIf cfg.useTruecolor true; + + extraConfigLua = mkIf (cfg.customColorScheme != null) '' + require('base16-colorscheme').setup(${helpers.toLuaObject cfg.customColorScheme}) + ''; }; } diff --git a/tests/test-sources/plugins/colorschemes/base16.nix b/tests/test-sources/plugins/colorschemes/base16.nix new file mode 100644 index 00000000..e39b5421 --- /dev/null +++ b/tests/test-sources/plugins/colorschemes/base16.nix @@ -0,0 +1,43 @@ +{ + # Empty configuration + empty = { + colorschemes.base16.enable = true; + }; + + # All the upstream default options of poimandres + defaults = { + colorschemes.base16 = { + enable = true; + + useTruecolor = true; + colorscheme = "gruvbox-dark-hard"; + setUpBar = true; + customColorScheme = null; + }; + }; + + custom-colors = { + colorschemes.base16 = { + enable = true; + + customColorScheme = { + base00 = "#16161D"; + base01 = "#2c313c"; + base02 = "#3e4451"; + base03 = "#6c7891"; + base04 = "#565c64"; + base05 = "#abb2bf"; + base06 = "#9a9bb3"; + base07 = "#c5c8e6"; + base08 = "#e06c75"; + base09 = "#d19a66"; + base0A = "#e5c07b"; + base0B = "#98c379"; + base0C = "#56b6c2"; + base0D = "#0184bc"; + base0E = "#c678dd"; + base0F = "#a06949"; + }; + }; + }; +}