plugins/poimandres: add colorscheme + test

This commit is contained in:
Gaetan Lepage 2023-04-13 22:26:23 +02:00 committed by Gaétan Lepage
parent 121566a267
commit 8ba084783e
3 changed files with 118 additions and 0 deletions

View file

@ -0,0 +1,63 @@
{
pkgs,
config,
lib,
...
} @ args:
with lib; let
cfg = config.colorschemes.poimandres;
helpers = import ../helpers.nix args;
in {
options = {
colorschemes.poimandres =
helpers.extraOptionsOptions
// {
enable = mkEnableOption "poimandres";
package = helpers.mkPackageOption "poimandres" pkgs.vimPlugins.poimandres-nvim;
boldVertSplit = helpers.defaultNullOpts.mkBool false "bold vertical split";
darkVariant = helpers.defaultNullOpts.mkStr "main" "dark variant";
disableBackground = helpers.defaultNullOpts.mkBool false "Whether to disable the background.";
disableFloatBackground =
helpers.defaultNullOpts.mkBool false
"Whether to disable the float background.";
disableItalics = helpers.defaultNullOpts.mkBool false "Whether to disable italics.";
dimNcBackground = helpers.defaultNullOpts.mkBool false "Dim NC background";
groups =
helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str)))
"groups";
highlightGroups = helpers.mkNullOrOption types.attrs "highlight groups";
};
};
config = let
setupOptions =
{
bold_vert_split = cfg.boldVertSplit;
dark_variant = cfg.darkVariant;
disable_background = cfg.disableBackground;
disable_float_background = cfg.disableFloatBackground;
disable_italics = cfg.disableItalics;
dim_nc_background = cfg.dimNcBackground;
inherit (cfg) groups;
highlight_groups = cfg.highlightGroups;
}
// cfg.extraOptions;
in
mkIf cfg.enable {
colorscheme = "poimandres";
extraPlugins = [cfg.package];
extraConfigLuaPre = ''
require("poimandres").setup(${helpers.toLuaObject setupOptions})
'';
};
}

View file

@ -8,6 +8,7 @@
./colorschemes/nord.nix ./colorschemes/nord.nix
./colorschemes/one.nix ./colorschemes/one.nix
./colorschemes/onedark.nix ./colorschemes/onedark.nix
./colorschemes/poimandres.nix
./colorschemes/tokyonight.nix ./colorschemes/tokyonight.nix
./completion/coq.nix ./completion/coq.nix

View file

@ -0,0 +1,54 @@
{
# Empty configuration
empty = {
colorschemes.poimandres.enable = true;
};
# All the upstream default options of poimandres
defaults = {
colorschemes.poimandres = {
enable = true;
boldVertSplit = false;
darkVariant = "main";
disableBackground = false;
disableFloatBackground = false;
disableItalics = false;
dimNcBackground = false;
groups = {
background = "background2";
panel = "background3";
border = "background3";
comment = "blueGray3";
link = "blue3";
punctuation = "blue3";
error = "pink3";
hint = "blue1";
info = "blue3";
warn = "yellow";
git_add = "teal1";
git_change = "blue2";
git_delete = "pink3";
git_dirty = "blue4";
git_ignore = "blueGray1";
git_merge = "blue2";
git_rename = "teal3";
git_stage = "blue1";
git_text = "teal2";
headings = {
h1 = "teal2";
h2 = "yellow";
h3 = "pink3";
h4 = "pink2";
h5 = "blue1";
h6 = "blue2";
};
};
highlightGroups = {};
};
};
}