mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
feature: add base16 support (#389)
* modules: add base16 Theming support theme/theme.nix: fix formatting supported-themes.nix: formatting clean up base16-colors.nix theme: fix plugin setup, change base16 flake input * theme/theme.nix: fix formatting * types/theme.nix: add check regex matching types/theme.nix: fixed regex matching * lib/types: rename custom.nix to types.nix, mov theme.nix into types.nix * plugins/theme: apply requested changes types/types.nix: remove unneeded inherit theme/theme.nix: remove commented inherit * theme/theme.nix: fix up base16 helper func Co-authored-by: diniamo <55629891+diniamo@users.noreply.github.com> * theme/theme.nix: move listToAttrs inheriting, fix base16-colors declaration * theme/theme.nix: add documentation to vim.theme.name * release-notes/rl-0.7.md: add changelog entry for base16 * theme/theme.nix: fix documentation rendering --------- Co-authored-by: diniamo <55629891+diniamo@users.noreply.github.com>
This commit is contained in:
parent
6670d752c7
commit
bdf777dc8a
7 changed files with 71 additions and 8 deletions
|
@ -4,32 +4,51 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.attrsets) attrNames;
|
||||
inherit (lib.attrsets) attrNames listToAttrs;
|
||||
inherit (lib.strings) hasPrefix;
|
||||
inherit (lib.types) bool lines enum;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
inherit (lib.nvim.types) hexColor;
|
||||
|
||||
cfg = config.vim.theme;
|
||||
supportedThemes = import ./supported-themes.nix {
|
||||
inherit lib config;
|
||||
};
|
||||
|
||||
numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"];
|
||||
base16Options = listToAttrs (map (n: {
|
||||
name = "base0${n}";
|
||||
value = mkOption {
|
||||
description = "The base0${n} color to use";
|
||||
type = hexColor;
|
||||
apply = v:
|
||||
if hasPrefix "#" v
|
||||
then v
|
||||
else "#${v}";
|
||||
};
|
||||
})
|
||||
numbers);
|
||||
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`";
|
||||
description = ''
|
||||
Supported themes can be found in {file}`supportedThemes.nix`.
|
||||
Setting the theme to "base16" enables base16 theming and
|
||||
requires all of the colors in {option}`vim.theme.base16-colors` to be set.
|
||||
'';
|
||||
};
|
||||
base16-colors = base16Options;
|
||||
|
||||
style = mkOption {
|
||||
type = enum supportedThemes.${cfg.name}.styles;
|
||||
description = "Specific style for theme if it supports it";
|
||||
};
|
||||
|
||||
transparent = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
|
@ -47,7 +66,7 @@ in {
|
|||
startPlugins = [cfg.name];
|
||||
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
||||
${cfg.extraConfig}
|
||||
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent;}}
|
||||
${supportedThemes.${cfg.name}.setup {inherit (cfg) style transparent base16-colors;}}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue