nvf/modules/plugins/theme/theme.nix
diniamo 67abc51902
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-html) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-json) (push) Has been cancelled
Validate flake & check documentation / Validate Flake Documentation (docs-manpages) (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
treewide: remove the theme section from the DAG order dependance (#369)
* treewide: remove the theme section from the DAG order dependance

* docs/dag-entries: correct theme entry note
2024-09-05 18:06:24 +00:00

55 lines
1.3 KiB
Nix

{
config,
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.attrsets) attrNames;
inherit (lib.types) bool lines enum;
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryBefore;
cfg = config.vim.theme;
supportedThemes = import ./supported-themes.nix {
inherit lib config;
};
in {
options.vim.theme = {
enable = mkOption {
type = bool;
description = "Enable theming";
};
name = mkOption {
type = enum (attrNames supportedThemes);
description = "Supported themes can be found in `supportedThemes.nix`";
};
style = mkOption {
type = enum supportedThemes.${cfg.name}.styles;
description = "Specific style for theme if it supports it";
};
transparent = mkOption {
type = bool;
default = false;
description = "Whether or not transparency should be enabled. Has no effect for themes that do not support transparency";
};
extraConfig = mkOption {
type = lines;
description = "Additional lua configuration to add before setup";
};
};
config = mkIf cfg.enable {
vim = {
startPlugins = [cfg.name];
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
${cfg.extraConfig}
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}}
'';
};
};
}