nix-community.nixvim/plugins/colorschemes/ayu.nix

56 lines
1.3 KiB
Nix
Raw Normal View History

2023-08-10 12:08:41 +02:00
{
lib,
helpers,
config,
pkgs,
2023-08-10 12:08:41 +02:00
...
}:
2023-08-10 12:08:41 +02:00
with lib; let
cfg = config.colorschemes.ayu;
in {
options = {
colorschemes.ayu =
helpers.neovim-plugin.extraOptionsOptions
2023-08-10 12:08:41 +02:00
// {
enable = mkEnableOption "ayu";
package = helpers.mkPackageOption "ayu" pkgs.vimPlugins.neovim-ayu;
mirage = helpers.defaultNullOpts.mkBool false ''
Set to `true` to use `mirage` variant instead of `dark` for dark background.
'';
overrides =
helpers.defaultNullOpts.mkStrLuaOr
(with helpers.nixvimTypes; attrsOf highlight)
2023-08-10 12:08:41 +02:00
"{}"
''
A dictionary of group names, each associated with a dictionary of parameters
(`bg`, `fg`, `sp` and `style`) and colors in hex.
Alternatively, `overrides` can be a function that returns a dictionary of the same
format.
You can use the function to override based on a dynamic condition, such as the value of
`background`.
'';
};
};
config = let
setupOptions = with cfg;
{
inherit overrides;
2023-08-10 12:08:41 +02:00
}
// cfg.extraOptions;
in
mkIf cfg.enable {
extraPlugins = [cfg.package];
extraConfigLuaPre = ''
local ayu = require("ayu")
ayu.setup(${helpers.toLuaObject setupOptions})
ayu.colorscheme()
2023-08-10 12:08:41 +02:00
'';
};
}