2023-02-01 19:11:37 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
|
|
|
inherit (lib) mkOption types attrNames mkIf nvim;
|
|
|
|
|
2023-02-01 19:11:37 +00:00
|
|
|
cfg = config.vim.theme;
|
2023-04-11 10:57:47 +00:00
|
|
|
supported_themes = import ./supported_themes.nix {inherit lib;};
|
2023-02-01 19:11:37 +00:00
|
|
|
in {
|
|
|
|
options.vim.theme = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
2023-04-02 16:58:57 +00:00
|
|
|
description = "Enable theming";
|
2023-02-01 19:11:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.enum (attrNames supported_themes);
|
|
|
|
description = "Supported themes can be found in `supported_themes.nix`";
|
|
|
|
};
|
|
|
|
|
|
|
|
style = mkOption {
|
|
|
|
type = with types; enum supported_themes.${cfg.name}.styles;
|
|
|
|
description = "Specific style for theme if it supports it";
|
|
|
|
};
|
|
|
|
|
2023-04-11 10:57:47 +00:00
|
|
|
transparent = mkOption {
|
|
|
|
type = with types; bool;
|
|
|
|
default = false;
|
|
|
|
description = "Whether or not transparency should be enabled. Has no effect for themes that do not support transparency";
|
|
|
|
};
|
|
|
|
|
2023-02-01 19:11:37 +00:00
|
|
|
extraConfig = mkOption {
|
|
|
|
type = with types; lines;
|
|
|
|
description = "Additional lua configuration to add before setup";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim.startPlugins = [cfg.name];
|
|
|
|
vim.luaConfigRC.themeSetup = nvim.dag.entryBefore ["theme"] cfg.extraConfig;
|
2023-04-18 21:54:44 +00:00
|
|
|
vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup (with cfg; {
|
|
|
|
inherit style transparent;
|
|
|
|
});
|
2023-02-01 19:11:37 +00:00
|
|
|
};
|
|
|
|
}
|