mirror of
https://github.com/danth/stylix
synced 2024-11-24 21:23:24 +00:00
nixvim: add stylix.targets.nixvim.plugin option
Add the stylix.targets.nixvim.plugin option to select between the previous base16-nvim and the new default mini.base16 [1] plugin, offering better plugin integration. [1]: https://github.com/echasnovski/mini.base16 Link: https://github.com/danth/stylix/pull/536 Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Tested-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
parent
14df1e6488
commit
17f6d6e5aa
1 changed files with 39 additions and 20 deletions
|
@ -3,10 +3,16 @@
|
|||
lib,
|
||||
options,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
cfg = config.stylix.targets.nixvim;
|
||||
in {
|
||||
options.stylix.targets.nixvim = {
|
||||
enable =
|
||||
config.lib.stylix.mkEnableTarget "nixvim" true;
|
||||
enable = config.lib.stylix.mkEnableTarget "nixvim" true;
|
||||
plugin = lib.mkOption {
|
||||
type = lib.types.enum [ "base16-nvim" "mini.base16" ];
|
||||
default = "mini.base16";
|
||||
description = "Plugin used for the colorscheme";
|
||||
};
|
||||
transparentBackground = {
|
||||
main = lib.mkEnableOption "background transparency for the main NeoVim window";
|
||||
signColumn = lib.mkEnableOption "background transparency for the NeoVim sign column";
|
||||
|
@ -38,31 +44,44 @@
|
|||
)
|
||||
];
|
||||
|
||||
config = lib.mkIf (config.stylix.enable && config.stylix.targets.nixvim.enable && (config.programs ? nixvim)) (
|
||||
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) {
|
||||
programs.nixvim = {
|
||||
colorschemes.base16 = {
|
||||
config = lib.mkIf (config.stylix.enable && cfg.enable && (config.programs ? nixvim)) (
|
||||
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) (lib.mkMerge [
|
||||
(lib.mkIf (cfg.plugin == "base16-nvim") {
|
||||
programs.nixvim.colorschemes.base16 = {
|
||||
enable = true;
|
||||
|
||||
colorscheme = {
|
||||
inherit (config.lib.stylix.colors.withHashtag)
|
||||
base00 base01 base02 base03 base04 base05 base06 base07
|
||||
base08 base09 base0A base0B base0C base0D base0E base0F;
|
||||
};
|
||||
|
||||
};
|
||||
})
|
||||
(lib.mkIf (cfg.plugin == "mini.base16") {
|
||||
programs.nixvim.plugins.mini = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
highlight = let
|
||||
cfg = config.stylix.targets.nixvim;
|
||||
transparent = {
|
||||
bg = "none";
|
||||
ctermbg = "none";
|
||||
modules.base16.palette = {
|
||||
inherit (config.lib.stylix.colors.withHashtag)
|
||||
base00 base01 base02 base03 base04 base05 base06 base07
|
||||
base08 base09 base0A base0B base0C base0D base0E base0F;
|
||||
};
|
||||
in {
|
||||
Normal = lib.mkIf cfg.transparentBackground.main transparent;
|
||||
NonText = lib.mkIf cfg.transparentBackground.main transparent;
|
||||
SignColumn = lib.mkIf cfg.transparentBackground.signColumn transparent;
|
||||
};
|
||||
};
|
||||
}
|
||||
})
|
||||
{
|
||||
programs.nixvim = {
|
||||
highlight = let
|
||||
transparent = {
|
||||
bg = "none";
|
||||
ctermbg = "none";
|
||||
};
|
||||
in {
|
||||
Normal = lib.mkIf cfg.transparentBackground.main transparent;
|
||||
NonText = lib.mkIf cfg.transparentBackground.main transparent;
|
||||
SignColumn = lib.mkIf cfg.transparentBackground.signColumn transparent;
|
||||
};
|
||||
};
|
||||
}
|
||||
])
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue