mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
colorschemes/base16: add settings
+ refactor
Added support for the plugin's "advanced" config settings. Removed the enum restriction and prefix concatenation, allowing anything to be passed through, including raw lua: fixes #1675 The theme list is now much shorter and is included directly in the option description. Some general cleanup, in particular to `extraConfig` and `customColorschemeType`.
This commit is contained in:
parent
6055d0f28c
commit
c0ea106b4b
3 changed files with 165 additions and 281 deletions
|
@ -6,25 +6,28 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
# We configure this plugin manually (no `settings` option) so there is no point in using
|
let
|
||||||
# `mkNeovimPlugin` here.
|
|
||||||
helpers.vim-plugin.mkVimPlugin config {
|
|
||||||
name = "base16";
|
name = "base16";
|
||||||
isColorscheme = true;
|
luaName = "base16-colorscheme";
|
||||||
originalName = "base16.nvim";
|
originalName = "base16.nvim";
|
||||||
|
in
|
||||||
|
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
|
inherit name luaName originalName;
|
||||||
|
setup = ".with_config";
|
||||||
defaultPackage = pkgs.vimPlugins.base16-nvim;
|
defaultPackage = pkgs.vimPlugins.base16-nvim;
|
||||||
|
isColorscheme = true;
|
||||||
|
|
||||||
maintainers = [ maintainers.GaetanLepage ];
|
maintainers = with maintainers; [
|
||||||
|
GaetanLepage
|
||||||
|
MattSturgeon
|
||||||
|
];
|
||||||
|
|
||||||
# We manually set the colorscheme if needed.
|
# TODO introduced 2024-03-12: remove after 24.11
|
||||||
colorscheme = null;
|
|
||||||
|
|
||||||
# TODO introduced 2024-03-12: remove 2024-05-12
|
|
||||||
imports =
|
imports =
|
||||||
let
|
let
|
||||||
basePluginPath = [
|
basePluginPath = [
|
||||||
"colorschemes"
|
"colorschemes"
|
||||||
"base16"
|
name
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
[
|
[
|
||||||
|
@ -37,94 +40,151 @@ helpers.vim-plugin.mkVimPlugin config {
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|
||||||
|
settingsExample = {
|
||||||
|
telescope_borders = true;
|
||||||
|
indentblankline = false;
|
||||||
|
dapui = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
telescope = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable telescope integration.
|
||||||
|
'';
|
||||||
|
|
||||||
|
telescope_borders = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Whether to display borders around telescope's panel.
|
||||||
|
'';
|
||||||
|
|
||||||
|
indentblankline = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable indentblankline integration.
|
||||||
|
'';
|
||||||
|
|
||||||
|
notify = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable notify integration.
|
||||||
|
'';
|
||||||
|
|
||||||
|
ts_rainbow = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable ts_rainbow integration.
|
||||||
|
'';
|
||||||
|
|
||||||
|
cmp = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable cmp integration.
|
||||||
|
'';
|
||||||
|
|
||||||
|
illuminate = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable illuminate integration.
|
||||||
|
'';
|
||||||
|
|
||||||
|
lsp_semantic = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable lsp_semantic integration.
|
||||||
|
'';
|
||||||
|
|
||||||
|
mini_completion = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable mini_completion integration.
|
||||||
|
'';
|
||||||
|
|
||||||
|
dapui = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Whether to enable dapui integration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraOptions = {
|
extraOptions = {
|
||||||
colorscheme =
|
colorscheme =
|
||||||
let
|
let
|
||||||
customColorschemeType = types.submodule {
|
customColorschemeType = types.submodule {
|
||||||
options = listToAttrs (
|
options = mapAttrs (
|
||||||
map
|
name: example:
|
||||||
(colorId: rec {
|
mkOption {
|
||||||
name = "base0" + colorId;
|
type = with helpers.nixvimTypes; maybeRaw str;
|
||||||
value = mkOption {
|
description = "The value for color `${name}`.";
|
||||||
type = types.str;
|
inherit example;
|
||||||
description = "The value for color `${name}`.";
|
}
|
||||||
example = "#16161D";
|
) customColorschemeExample;
|
||||||
};
|
|
||||||
})
|
|
||||||
[
|
|
||||||
"0"
|
|
||||||
"1"
|
|
||||||
"2"
|
|
||||||
"3"
|
|
||||||
"4"
|
|
||||||
"5"
|
|
||||||
"6"
|
|
||||||
"7"
|
|
||||||
"8"
|
|
||||||
"9"
|
|
||||||
"A"
|
|
||||||
"B"
|
|
||||||
"C"
|
|
||||||
"D"
|
|
||||||
"E"
|
|
||||||
"F"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
customColorschemeExample = {
|
||||||
|
base00 = "#16161D";
|
||||||
|
base01 = "#2c313c";
|
||||||
|
base02 = "#3e4451";
|
||||||
|
base03 = "#6c7891";
|
||||||
|
base04 = "#565c64";
|
||||||
|
base05 = "#abb2bf";
|
||||||
|
base06 = "#9a9bb3";
|
||||||
|
base07 = "#c5c8e6";
|
||||||
|
base08 = "#e06c75";
|
||||||
|
base09 = "#d19a66";
|
||||||
|
base0A = "#e5c07b";
|
||||||
|
base0B = "#98c379";
|
||||||
|
base0C = "#56b6c2";
|
||||||
|
base0D = "#0184bc";
|
||||||
|
base0E = "#c678dd";
|
||||||
|
base0F = "#a06949";
|
||||||
|
};
|
||||||
|
|
||||||
|
builtinColorschemeExamples = import ./theme-list.nix;
|
||||||
in
|
in
|
||||||
mkOption {
|
helpers.defaultNullOpts.mkNullable' {
|
||||||
type = with types; either (enum (import ./theme-list.nix)) customColorschemeType;
|
type = types.oneOf [
|
||||||
|
types.str
|
||||||
|
customColorschemeType
|
||||||
|
helpers.nixvimTypes.rawLua
|
||||||
|
];
|
||||||
|
pluginDefault = literalMD ''`vim.env.BASE16_THEME` or `"schemer-dark"`'';
|
||||||
description = ''
|
description = ''
|
||||||
The base16 colorscheme to use.
|
The base16 colorscheme to use.
|
||||||
It can either be the name of a builtin colorscheme or an attrs specifying each color explicitly.
|
|
||||||
|
|
||||||
Example for the latter:
|
You may use the name of a builtin colorscheme or an attrs that specifies the colors explicitly.
|
||||||
|
|
||||||
|
Examples of builtin themes include:
|
||||||
|
${concatStrings (
|
||||||
|
map (e: ''
|
||||||
|
- "${e}"
|
||||||
|
'') builtinColorschemeExamples
|
||||||
|
)}
|
||||||
|
|
||||||
|
`:h nvim-base16-builtin-colorschemes` includes a full list of builtin themes,
|
||||||
|
however the [plugin's source code] may be more up to date.
|
||||||
|
|
||||||
|
You can access `require('${luaName}')` as `base16` in any raw lua,
|
||||||
|
for example, you could reuse some colors from the builtin colorschemes:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
base03.__raw = "base16.colorschemes['catppuccin'].base06";
|
||||||
base00 = "#16161D";
|
|
||||||
base01 = "#2c313c";
|
|
||||||
base02 = "#3e4451";
|
|
||||||
base03 = "#6c7891";
|
|
||||||
base04 = "#565c64";
|
|
||||||
base05 = "#abb2bf";
|
|
||||||
base06 = "#9a9bb3";
|
|
||||||
base07 = "#c5c8e6";
|
|
||||||
base08 = "#e06c75";
|
|
||||||
base09 = "#d19a66";
|
|
||||||
base0A = "#e5c07b";
|
|
||||||
base0B = "#98c379";
|
|
||||||
base0C = "#56b6c2";
|
|
||||||
base0D = "#0184bc";
|
|
||||||
base0E = "#c678dd";
|
|
||||||
base0F = "#a06949";
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[plugin's source code]: https://github.com/RRethy/base16-nvim/blob/master/lua/colors/init.lua
|
||||||
'';
|
'';
|
||||||
example = "edge-light";
|
example = customColorschemeExample;
|
||||||
};
|
};
|
||||||
|
|
||||||
setUpBar = mkOption {
|
setUpBar = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
example = false;
|
||||||
description = "Whether to set your status bar theme to 'base16'.";
|
description = "Whether to set your status bar theme to 'base16'.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig =
|
# We will manually set the colorscheme, using `setup`
|
||||||
cfg:
|
colorscheme = null;
|
||||||
mkMerge [
|
callSetup = false;
|
||||||
{
|
|
||||||
plugins.airline.settings.theme = mkIf cfg.setUpBar "base16";
|
|
||||||
plugins.lualine.theme = mkIf cfg.setUpBar "base16";
|
|
||||||
plugins.lightline.colorscheme = null;
|
|
||||||
|
|
||||||
opts.termguicolors = mkDefault true;
|
extraConfig = cfg: {
|
||||||
}
|
plugins.airline.settings.theme = mkIf cfg.setUpBar (mkDefault name);
|
||||||
(mkIf (isString cfg.colorscheme) { colorscheme = "base16-${cfg.colorscheme}"; })
|
plugins.lualine.theme = mkIf cfg.setUpBar (mkDefault name);
|
||||||
(mkIf (isAttrs cfg.colorscheme) {
|
plugins.lightline.colorscheme = mkDefault null;
|
||||||
extraConfigLuaPre = ''
|
|
||||||
require('base16-colorscheme').setup(${helpers.toLuaObject cfg.colorscheme})
|
opts.termguicolors = mkDefault true;
|
||||||
'';
|
|
||||||
})
|
# `settings` can either be passed to `with_config` before calling `setup`,
|
||||||
];
|
# or it can be passed as `setup`'s 2nd argument.
|
||||||
|
# See https://github.com/RRethy/base16-nvim/blob/6ac181b5733518040a33017dde654059cd771b7c/lua/base16-colorscheme.lua#L107-L125
|
||||||
|
extraConfigLuaPre = ''
|
||||||
|
do
|
||||||
|
local base16 = require('${luaName}')
|
||||||
|
base16.with_config(${helpers.toLuaObject cfg.settings})
|
||||||
|
base16.setup(${helpers.toLuaObject cfg.colorscheme})
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,107 +1,16 @@
|
||||||
# This is a list of all base16 themes
|
# Example base16 builtin themes to include in the docs
|
||||||
[
|
[
|
||||||
"3024"
|
|
||||||
"apathy"
|
|
||||||
"apprentice"
|
|
||||||
"ashes"
|
|
||||||
"atelier-cave"
|
|
||||||
"atelier-cave-light"
|
|
||||||
"atelier-dune"
|
|
||||||
"atelier-dune-light"
|
|
||||||
"atelier-estuary"
|
|
||||||
"atelier-estuary-light"
|
|
||||||
"atelier-forest"
|
|
||||||
"atelier-forest-light"
|
|
||||||
"atelier-heath"
|
|
||||||
"atelier-heath-light"
|
|
||||||
"atelier-lakeside"
|
|
||||||
"atelier-lakeside-light"
|
|
||||||
"atelier-plateau"
|
|
||||||
"atelier-plateau-light"
|
|
||||||
"atelier-savanna"
|
|
||||||
"atelier-savanna-light"
|
|
||||||
"atelier-seaside"
|
|
||||||
"atelier-seaside-light"
|
|
||||||
"atelier-sulphurpool"
|
|
||||||
"atelier-sulphurpool-light"
|
|
||||||
"atlas"
|
|
||||||
"ayu-dark"
|
|
||||||
"ayu-light"
|
|
||||||
"ayu-mirage"
|
|
||||||
"bespin"
|
|
||||||
"black-metal"
|
|
||||||
"black-metal-bathory"
|
|
||||||
"black-metal-burzum"
|
|
||||||
"black-metal-dark-funeral"
|
|
||||||
"black-metal-gorgoroth"
|
|
||||||
"black-metal-immortal"
|
|
||||||
"black-metal-khold"
|
|
||||||
"black-metal-marduk"
|
|
||||||
"black-metal-mayhem"
|
|
||||||
"black-metal-nile"
|
|
||||||
"black-metal-venom"
|
|
||||||
"blueforest"
|
|
||||||
"blueish"
|
|
||||||
"brewer"
|
|
||||||
"bright"
|
|
||||||
"brogrammer"
|
|
||||||
"brushtrees"
|
|
||||||
"brushtrees-dark"
|
|
||||||
"catppuccin"
|
"catppuccin"
|
||||||
"catppuccin-frappe"
|
"catppuccin-frappe"
|
||||||
"catppuccin-latte"
|
"catppuccin-latte"
|
||||||
"catppuccin-macchiato"
|
"catppuccin-macchiato"
|
||||||
"catppuccin-mocha"
|
"catppuccin-mocha"
|
||||||
"chalk"
|
|
||||||
"circus"
|
|
||||||
"classic-dark"
|
|
||||||
"classic-light"
|
|
||||||
"codeschool"
|
|
||||||
"colors"
|
|
||||||
"cupcake"
|
|
||||||
"cupertino"
|
|
||||||
"da-one-black"
|
|
||||||
"da-one-gray"
|
|
||||||
"da-one-ocean"
|
|
||||||
"da-one-paper"
|
|
||||||
"da-one-sea"
|
|
||||||
"da-one-white"
|
|
||||||
"danqing"
|
|
||||||
"darcula"
|
"darcula"
|
||||||
"darkmoss"
|
|
||||||
"darktooth"
|
|
||||||
"darkviolet"
|
|
||||||
"decaf"
|
|
||||||
"default-dark"
|
|
||||||
"default-light"
|
|
||||||
"dirtysea"
|
|
||||||
"dracula"
|
"dracula"
|
||||||
"edge-dark"
|
|
||||||
"edge-light"
|
|
||||||
"eighties"
|
|
||||||
"embers"
|
|
||||||
"emil"
|
|
||||||
"equilibrium-dark"
|
|
||||||
"equilibrium-gray-dark"
|
|
||||||
"equilibrium-gray-light"
|
|
||||||
"equilibrium-light"
|
|
||||||
"espresso"
|
"espresso"
|
||||||
"eva"
|
|
||||||
"eva-dim"
|
|
||||||
"evenok-dark"
|
|
||||||
"everforest"
|
|
||||||
"flat"
|
|
||||||
"framer"
|
|
||||||
"fruit-soda"
|
|
||||||
"gigavolt"
|
|
||||||
"github"
|
"github"
|
||||||
"google-dark"
|
"google-dark"
|
||||||
"google-light"
|
"google-light"
|
||||||
"gotham"
|
|
||||||
"grayscale-dark"
|
|
||||||
"grayscale-light"
|
|
||||||
"greenscreen"
|
|
||||||
"gruber"
|
|
||||||
"gruvbox-dark-hard"
|
"gruvbox-dark-hard"
|
||||||
"gruvbox-dark-medium"
|
"gruvbox-dark-medium"
|
||||||
"gruvbox-dark-pale"
|
"gruvbox-dark-pale"
|
||||||
|
@ -109,135 +18,26 @@
|
||||||
"gruvbox-light-hard"
|
"gruvbox-light-hard"
|
||||||
"gruvbox-light-medium"
|
"gruvbox-light-medium"
|
||||||
"gruvbox-light-soft"
|
"gruvbox-light-soft"
|
||||||
"gruvbox-material-dark-hard"
|
|
||||||
"gruvbox-material-dark-medium"
|
|
||||||
"gruvbox-material-dark-soft"
|
|
||||||
"gruvbox-material-light-hard"
|
|
||||||
"gruvbox-material-light-medium"
|
|
||||||
"gruvbox-material-light-soft"
|
|
||||||
"hardcore"
|
|
||||||
"harmonic-dark"
|
|
||||||
"harmonic-light"
|
|
||||||
"heetch"
|
|
||||||
"heetch-light"
|
|
||||||
"helios"
|
|
||||||
"hopscotch"
|
|
||||||
"horizon-dark"
|
|
||||||
"horizon-light"
|
|
||||||
"horizon-terminal-dark"
|
|
||||||
"horizon-terminal-light"
|
|
||||||
"humanoid-dark"
|
|
||||||
"humanoid-light"
|
|
||||||
"ia-dark"
|
|
||||||
"ia-light"
|
|
||||||
"icy"
|
|
||||||
"irblack"
|
|
||||||
"isotope"
|
|
||||||
"kanagawa"
|
|
||||||
"katy"
|
|
||||||
"kimber"
|
|
||||||
"lime"
|
|
||||||
"macintosh"
|
|
||||||
"marrakesh"
|
|
||||||
"materia"
|
|
||||||
"material"
|
"material"
|
||||||
"material-darker"
|
"material-darker"
|
||||||
"material-lighter"
|
"material-lighter"
|
||||||
"material-palenight"
|
"material-palenight"
|
||||||
"material-vivid"
|
"material-vivid"
|
||||||
"mellow-purple"
|
|
||||||
"mexico-light"
|
|
||||||
"mocha"
|
|
||||||
"monokai"
|
|
||||||
"mountain"
|
|
||||||
"nebula"
|
|
||||||
"nord"
|
"nord"
|
||||||
"nova"
|
"nova"
|
||||||
"ocean"
|
"ocean"
|
||||||
"oceanicnext"
|
|
||||||
"one-light"
|
|
||||||
"onedark"
|
"onedark"
|
||||||
"outrun-dark"
|
|
||||||
"pandora"
|
|
||||||
"papercolor-dark"
|
|
||||||
"papercolor-light"
|
|
||||||
"paraiso"
|
|
||||||
"pasque"
|
|
||||||
"phd"
|
|
||||||
"pico"
|
|
||||||
"pinky"
|
|
||||||
"pop"
|
|
||||||
"porple"
|
|
||||||
"primer-dark"
|
|
||||||
"primer-dark-dimmed"
|
|
||||||
"primer-light"
|
|
||||||
"purpledream"
|
|
||||||
"qualia"
|
|
||||||
"railscasts"
|
|
||||||
"rebecca"
|
|
||||||
"rose-pine"
|
"rose-pine"
|
||||||
"rose-pine-dawn"
|
"rose-pine-dawn"
|
||||||
"rose-pine-moon"
|
"rose-pine-moon"
|
||||||
"sagelight"
|
|
||||||
"sakura"
|
|
||||||
"sandcastle"
|
|
||||||
"seti"
|
|
||||||
"shades-of-purple"
|
|
||||||
"shadesmear-dark"
|
|
||||||
"shadesmear-light"
|
|
||||||
"shapeshifter"
|
|
||||||
"silk-dark"
|
|
||||||
"silk-light"
|
|
||||||
"snazzy"
|
|
||||||
"solarflare"
|
|
||||||
"solarflare-light"
|
|
||||||
"solarized-dark"
|
"solarized-dark"
|
||||||
"solarized-light"
|
"solarized-light"
|
||||||
"spaceduck"
|
|
||||||
"spacemacs"
|
|
||||||
"standardized-dark"
|
|
||||||
"standardized-light"
|
|
||||||
"stella"
|
|
||||||
"still-alive"
|
|
||||||
"summercamp"
|
|
||||||
"summerfruit-dark"
|
|
||||||
"summerfruit-light"
|
|
||||||
"synth-midnight-dark"
|
|
||||||
"synth-midnight-light"
|
|
||||||
"tango"
|
"tango"
|
||||||
"tender"
|
|
||||||
"tokyo-city-dark"
|
|
||||||
"tokyo-city-light"
|
|
||||||
"tokyo-city-terminal-dark"
|
|
||||||
"tokyo-city-terminal-light"
|
|
||||||
"tokyo-night-dark"
|
"tokyo-night-dark"
|
||||||
"tokyo-night-light"
|
"tokyo-night-light"
|
||||||
"tokyo-night-storm"
|
"tokyo-night-storm"
|
||||||
"tokyo-night-terminal-dark"
|
"tokyo-night-terminal-dark"
|
||||||
"tokyo-night-terminal-light"
|
"tokyo-night-terminal-light"
|
||||||
"tokyo-night-terminal-storm"
|
"tokyo-night-terminal-storm"
|
||||||
"tokyodark"
|
|
||||||
"tokyodark-terminal"
|
|
||||||
"tomorrow"
|
|
||||||
"tomorrow-night"
|
|
||||||
"tomorrow-night-eighties"
|
|
||||||
"tube"
|
|
||||||
"twilight"
|
|
||||||
"unikitty-dark"
|
|
||||||
"unikitty-light"
|
|
||||||
"unikitty-reversible"
|
|
||||||
"uwunicorn"
|
|
||||||
"vice"
|
|
||||||
"vulcan"
|
|
||||||
"windows-10"
|
|
||||||
"windows-10-light"
|
|
||||||
"windows-95"
|
|
||||||
"windows-95-light"
|
|
||||||
"windows-highcontrast"
|
|
||||||
"windows-highcontrast-light"
|
|
||||||
"windows-nt"
|
|
||||||
"windows-nt-light"
|
|
||||||
"woodland"
|
"woodland"
|
||||||
"xcode-dusk"
|
|
||||||
"zenburn"
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,12 +1,36 @@
|
||||||
{
|
{
|
||||||
# No empty test because not setting `colorscheme` would error
|
empty = {
|
||||||
|
colorschemes.base16.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
colorschemes.base16 = {
|
colorschemes.base16 = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
colorscheme = "gruvbox-dark-hard";
|
colorscheme = "schemer-dark";
|
||||||
setUpBar = true;
|
setUpBar = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
telescope = true;
|
||||||
|
telescope_borders = false;
|
||||||
|
indentblankline = true;
|
||||||
|
notify = true;
|
||||||
|
ts_rainbow = true;
|
||||||
|
cmp = true;
|
||||||
|
illuminate = true;
|
||||||
|
lsp_semantic = true;
|
||||||
|
mini_completion = true;
|
||||||
|
dapui = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
builtin-colorscheme = {
|
||||||
|
colorschemes.base16 = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
colorscheme = "gruvbox-dark-hard";
|
||||||
|
setUpBar = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue