mirror of
https://github.com/danth/stylix
synced 2025-02-16 13:28:35 +00:00
neovim: use mini.base16 for colorscheme (#536)
This commit is contained in:
commit
6616348cac
2 changed files with 77 additions and 38 deletions
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
options.stylix.targets.neovim = {
|
options.stylix.targets.neovim = {
|
||||||
enable =
|
enable = config.lib.stylix.mkEnableTarget "Neovim" true;
|
||||||
config.lib.stylix.mkEnableTarget "Neovim" true;
|
plugin = lib.mkOption {
|
||||||
|
type = lib.types.enum [ "base16-nvim" "mini.base16" ];
|
||||||
|
default = "mini.base16";
|
||||||
|
description = "Plugin used for the colorscheme";
|
||||||
|
};
|
||||||
transparentBackground = {
|
transparentBackground = {
|
||||||
main = lib.mkEnableOption "background transparency for the main Neovim window";
|
main = lib.mkEnableOption "background transparency for the main Neovim window";
|
||||||
signColumn = lib.mkEnableOption "background transparency for the Neovim sign column";
|
signColumn = lib.mkEnableOption "background transparency for the Neovim sign column";
|
||||||
|
@ -17,18 +20,36 @@
|
||||||
cfg = config.stylix.targets.neovim;
|
cfg = config.stylix.targets.neovim;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
plugins = lib.singleton {
|
plugins = [
|
||||||
|
(lib.mkIf (cfg.plugin == "base16-nvim") {
|
||||||
plugin = pkgs.vimPlugins.base16-nvim;
|
plugin = pkgs.vimPlugins.base16-nvim;
|
||||||
type = "lua";
|
type = "lua";
|
||||||
config = lib.mkMerge [
|
config = with config.lib.stylix.colors.withHashtag; ''
|
||||||
(with config.lib.stylix.colors.withHashtag; ''
|
|
||||||
require('base16-colorscheme').setup({
|
require('base16-colorscheme').setup({
|
||||||
base00 = '${base00}', base01 = '${base01}', base02 = '${base02}', base03 = '${base03}',
|
base00 = '${base00}', base01 = '${base01}', base02 = '${base02}', base03 = '${base03}',
|
||||||
base04 = '${base04}', base05 = '${base05}', base06 = '${base06}', base07 = '${base07}',
|
base04 = '${base04}', base05 = '${base05}', base06 = '${base06}', base07 = '${base07}',
|
||||||
base08 = '${base08}', base09 = '${base09}', base0A = '${base0A}', base0B = '${base0B}',
|
base08 = '${base08}', base09 = '${base09}', base0A = '${base0A}', base0B = '${base0B}',
|
||||||
base0C = '${base0C}', base0D = '${base0D}', base0E = '${base0E}', base0F = '${base0F}'
|
base0C = '${base0C}', base0D = '${base0D}', base0E = '${base0E}', base0F = '${base0F}'
|
||||||
})
|
})
|
||||||
'')
|
'';
|
||||||
|
})
|
||||||
|
(lib.mkIf (cfg.plugin == "mini.base16") {
|
||||||
|
plugin = pkgs.vimPlugins.mini-nvim;
|
||||||
|
type = "lua";
|
||||||
|
config = with config.lib.stylix.colors.withHashtag; ''
|
||||||
|
require('mini.base16').setup({
|
||||||
|
palette = {
|
||||||
|
base00 = '${base00}', base01 = '${base01}', base02 = '${base02}', base03 = '${base03}',
|
||||||
|
base04 = '${base04}', base05 = '${base05}', base06 = '${base06}', base07 = '${base07}',
|
||||||
|
base08 = '${base08}', base09 = '${base09}', base0A = '${base0A}', base0B = '${base0B}',
|
||||||
|
base0C = '${base0C}', base0D = '${base0D}', base0E = '${base0E}', base0F = '${base0F}'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
extraLuaConfig = lib.mkMerge [
|
||||||
(lib.mkIf cfg.transparentBackground.main ''
|
(lib.mkIf cfg.transparentBackground.main ''
|
||||||
vim.cmd.highlight({ "Normal", "guibg=NONE", "ctermbg=NONE" })
|
vim.cmd.highlight({ "Normal", "guibg=NONE", "ctermbg=NONE" })
|
||||||
vim.cmd.highlight({ "NonText", "guibg=NONE", "ctermbg=NONE" })
|
vim.cmd.highlight({ "NonText", "guibg=NONE", "ctermbg=NONE" })
|
||||||
|
@ -39,5 +60,4 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,16 @@
|
||||||
lib,
|
lib,
|
||||||
options,
|
options,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
cfg = config.stylix.targets.nixvim;
|
||||||
|
in {
|
||||||
options.stylix.targets.nixvim = {
|
options.stylix.targets.nixvim = {
|
||||||
enable =
|
enable = config.lib.stylix.mkEnableTarget "nixvim" true;
|
||||||
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 = {
|
transparentBackground = {
|
||||||
main = lib.mkEnableOption "background transparency for the main NeoVim window";
|
main = lib.mkEnableOption "background transparency for the main NeoVim window";
|
||||||
signColumn = lib.mkEnableOption "background transparency for the NeoVim sign column";
|
signColumn = lib.mkEnableOption "background transparency for the NeoVim sign column";
|
||||||
|
@ -38,21 +44,33 @@
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
config = lib.mkIf (config.stylix.enable && config.stylix.targets.nixvim.enable && (config.programs ? nixvim)) (
|
config = lib.mkIf (config.stylix.enable && cfg.enable && (config.programs ? nixvim)) (
|
||||||
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) {
|
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) (lib.mkMerge [
|
||||||
programs.nixvim = {
|
(lib.mkIf (cfg.plugin == "base16-nvim") {
|
||||||
colorschemes.base16 = {
|
programs.nixvim.colorschemes.base16 = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
colorscheme = {
|
colorscheme = {
|
||||||
inherit (config.lib.stylix.colors.withHashtag)
|
inherit (config.lib.stylix.colors.withHashtag)
|
||||||
base00 base01 base02 base03 base04 base05 base06 base07
|
base00 base01 base02 base03 base04 base05 base06 base07
|
||||||
base08 base09 base0A base0B base0C base0D base0E base0F;
|
base08 base09 base0A base0B base0C base0D base0E base0F;
|
||||||
};
|
};
|
||||||
|
|
||||||
enable = true;
|
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
(lib.mkIf (cfg.plugin == "mini.base16") {
|
||||||
|
programs.nixvim.plugins.mini = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
highlight = let
|
highlight = let
|
||||||
cfg = config.stylix.targets.nixvim;
|
|
||||||
transparent = {
|
transparent = {
|
||||||
bg = "none";
|
bg = "none";
|
||||||
ctermbg = "none";
|
ctermbg = "none";
|
||||||
|
@ -64,5 +82,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue