mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-24 17:58:38 +02:00
colorschemes/kanagawa: switch to mkNeovimPlugin
This commit is contained in:
parent
ce87283dd6
commit
c6d4505438
2 changed files with 235 additions and 201 deletions
|
@ -5,195 +5,225 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
cfg = config.colorschemes.kanagawa;
|
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
in {
|
name = "kanagawa";
|
||||||
options = {
|
isColorscheme = true;
|
||||||
colorschemes.kanagawa =
|
originalName = "kanagawa.nvim";
|
||||||
helpers.neovim-plugin.extraOptionsOptions
|
defaultPackage = pkgs.vimPlugins.kanagawa-nvim;
|
||||||
// {
|
|
||||||
enable = mkEnableOption "kanagawa";
|
|
||||||
|
|
||||||
package = helpers.mkPackageOption "kanagawa" pkgs.vimPlugins.kanagawa-nvim;
|
description = ''
|
||||||
|
You can select the theme in two ways:
|
||||||
|
- Set `colorschemes.kanagawa.settings.theme` AND explicitly unset `vim.o.background` (i.e. `options.background = ""`).
|
||||||
|
- Set `colorschemes.kanagawa.settings.background` (the active theme will depend on the value of `vim.o.background`).
|
||||||
|
'';
|
||||||
|
|
||||||
compile = helpers.defaultNullOpts.mkBool false "Enable compiling the colorscheme.";
|
maintainers = [maintainers.GaetanLepage];
|
||||||
|
|
||||||
undercurl = helpers.defaultNullOpts.mkBool true "Enable undercurls.";
|
# TODO introduced 2024-03-15: remove 2024-05-15
|
||||||
|
deprecateExtraOptions = true;
|
||||||
|
imports = let
|
||||||
|
basePluginPath = ["colorschemes" "kanagawa"];
|
||||||
|
in
|
||||||
|
(
|
||||||
|
map
|
||||||
|
(
|
||||||
|
optionPath:
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(basePluginPath ++ optionPath)
|
||||||
|
(basePluginPath ++ ["settings"] ++ optionPath)
|
||||||
|
)
|
||||||
|
[
|
||||||
|
["compile"]
|
||||||
|
["undercurl"]
|
||||||
|
["commentStyle"]
|
||||||
|
["functionStyle"]
|
||||||
|
["keywordStyle"]
|
||||||
|
["statementStyle"]
|
||||||
|
["typeStyle"]
|
||||||
|
["transparent"]
|
||||||
|
["dimInactive"]
|
||||||
|
["terminalColors"]
|
||||||
|
["colors" "palette"]
|
||||||
|
["colors" "theme"]
|
||||||
|
["theme"]
|
||||||
|
["background" "dark"]
|
||||||
|
["background" "light"]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
++ [
|
||||||
|
(
|
||||||
|
mkRemovedOptionModule
|
||||||
|
(basePluginPath ++ ["overrides"])
|
||||||
|
''
|
||||||
|
Use `colorschemes.kanagawa.settings.overrides` but you now have to add the full function definition:
|
||||||
|
```
|
||||||
|
function(colors)
|
||||||
|
...
|
||||||
|
end
|
||||||
|
```
|
||||||
|
''
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
commentStyle =
|
settingsOptions = {
|
||||||
helpers.defaultNullOpts.mkNullable
|
compile = helpers.defaultNullOpts.mkBool false ''
|
||||||
types.attrs
|
Enable compiling the colorscheme.
|
||||||
"{italic = true;}"
|
'';
|
||||||
"Highlight options for comments.";
|
|
||||||
|
|
||||||
functionStyle =
|
undercurl = helpers.defaultNullOpts.mkBool true ''
|
||||||
helpers.defaultNullOpts.mkNullable
|
Enable undercurls.
|
||||||
types.attrs
|
'';
|
||||||
"{}"
|
|
||||||
"Highlight options for functions.";
|
|
||||||
|
|
||||||
keywordStyle =
|
commentStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
|
||||||
helpers.defaultNullOpts.mkNullable
|
Highlight options for comments.
|
||||||
types.attrs
|
'';
|
||||||
"{italic = true;}"
|
|
||||||
"Highlight options for keywords.";
|
|
||||||
|
|
||||||
statementStyle =
|
functionStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
|
||||||
helpers.defaultNullOpts.mkNullable
|
Highlight options for functions.
|
||||||
types.attrs
|
'';
|
||||||
"{bold = true;}"
|
|
||||||
"Highlight options for statements.";
|
|
||||||
|
|
||||||
typeStyle =
|
keywordStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{italic = true;}" ''
|
||||||
helpers.defaultNullOpts.mkNullable
|
Highlight options for keywords.
|
||||||
types.attrs
|
'';
|
||||||
"{}"
|
|
||||||
"Highlight options for types.";
|
|
||||||
|
|
||||||
transparent = helpers.defaultNullOpts.mkBool false "Whether to set a background color.";
|
statementStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{bold = true;}" ''
|
||||||
|
Highlight options for statements.
|
||||||
|
'';
|
||||||
|
|
||||||
dimInactive = helpers.defaultNullOpts.mkBool false ''
|
typeStyle = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
|
||||||
Whether dim inactive window `:h hl-NormalNC`.
|
Highlight options for types.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
terminalColors = helpers.defaultNullOpts.mkBool true ''
|
transparent = helpers.defaultNullOpts.mkBool false ''
|
||||||
If true, defines `vim.g.terminal_color_{0,17}`.
|
Whether to set a background color.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
colors = {
|
dimInactive = helpers.defaultNullOpts.mkBool false ''
|
||||||
theme =
|
Whether dim inactive window `:h hl-NormalNC`.
|
||||||
helpers.defaultNullOpts.mkNullable
|
'';
|
||||||
(with types; attrsOf attrs)
|
|
||||||
''
|
|
||||||
{
|
|
||||||
wave = {};
|
|
||||||
lotus = {};
|
|
||||||
dragon = {};
|
|
||||||
all = {};
|
|
||||||
}
|
|
||||||
''
|
|
||||||
''
|
|
||||||
Change specific usages for a certain theme, or for all of them
|
|
||||||
|
|
||||||
Example:
|
terminalColors = helpers.defaultNullOpts.mkBool true ''
|
||||||
```nix
|
If true, defines `vim.g.terminal_color_{0,17}`.
|
||||||
{
|
'';
|
||||||
wave = {
|
|
||||||
ui = {
|
|
||||||
float = {
|
|
||||||
bg = "none";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
dragon = {
|
|
||||||
syn = {
|
|
||||||
parameter = "yellow";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
all = {
|
|
||||||
ui = {
|
|
||||||
bg_gutter = "none";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
'';
|
|
||||||
|
|
||||||
palette = helpers.defaultNullOpts.mkNullable (with types; attrsOf str) "{}" ''
|
colors = {
|
||||||
Change all usages of these colors.
|
theme =
|
||||||
|
helpers.defaultNullOpts.mkAttrsOf types.attrs
|
||||||
|
''
|
||||||
|
{
|
||||||
|
wave = {};
|
||||||
|
lotus = {};
|
||||||
|
dragon = {};
|
||||||
|
all = {};
|
||||||
|
}
|
||||||
|
''
|
||||||
|
''
|
||||||
|
Change specific usages for a certain theme, or for all of them
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
sumiInk0 = "#000000";
|
wave = {
|
||||||
fujiWhite = "#FFFFFF";
|
ui = {
|
||||||
|
float = {
|
||||||
|
bg = "none";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
dragon = {
|
||||||
|
syn = {
|
||||||
|
parameter = "yellow";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
all = {
|
||||||
|
ui = {
|
||||||
|
bg_gutter = "none";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
overrides =
|
palette = helpers.defaultNullOpts.mkAttrsOf types.str "{}" ''
|
||||||
helpers.defaultNullOpts.mkStr
|
Change all usages of these colors.
|
||||||
''
|
|
||||||
return {}
|
|
||||||
''
|
|
||||||
''
|
|
||||||
The body of a function that add/modify hihlights.
|
|
||||||
It takes as input a `colors` argument which is a table of this form:
|
|
||||||
```
|
|
||||||
colors = {
|
|
||||||
palette = {
|
|
||||||
foo = "#RRGGBB",
|
|
||||||
bar = "#RRGGBB"
|
|
||||||
},
|
|
||||||
theme = {
|
|
||||||
foo = "#RRGGBB",
|
|
||||||
bar = "#RRGGBB"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
It should return a table of highlights.
|
|
||||||
|
|
||||||
```
|
Example:
|
||||||
function(colors)
|
```nix
|
||||||
CONTENT_OF_OVERRIDE_OPTION
|
{
|
||||||
end
|
sumiInk0 = "#000000";
|
||||||
```
|
fujiWhite = "#FFFFFF";
|
||||||
'';
|
}
|
||||||
|
```
|
||||||
theme = helpers.defaultNullOpts.mkStr "wave" ''
|
|
||||||
The theme to load when background is not set.
|
|
||||||
'';
|
'';
|
||||||
background = {
|
};
|
||||||
light = helpers.defaultNullOpts.mkStr "lotus" ''
|
|
||||||
The theme to use when `vim.o.background = "light"`.
|
|
||||||
'';
|
|
||||||
|
|
||||||
dark = helpers.defaultNullOpts.mkStr "wave" ''
|
overrides =
|
||||||
The theme to use when `vim.o.background = "dark"`.
|
helpers.defaultNullOpts.mkLuaFn
|
||||||
'';
|
''
|
||||||
|
function(colors)
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
''
|
||||||
|
''
|
||||||
|
The body of a function that add/modify hihlights.
|
||||||
|
It takes as input a `colors` argument which is a table of this form:
|
||||||
|
```
|
||||||
|
colors = {
|
||||||
|
palette = {
|
||||||
|
foo = "#RRGGBB",
|
||||||
|
bar = "#RRGGBB"
|
||||||
|
},
|
||||||
|
theme = {
|
||||||
|
foo = "#RRGGBB",
|
||||||
|
bar = "#RRGGBB"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
It should return a table of highlights.
|
||||||
|
|
||||||
|
```
|
||||||
|
function(colors)
|
||||||
|
CONTENT_OF_OVERRIDE_OPTION
|
||||||
|
end
|
||||||
|
```
|
||||||
|
'';
|
||||||
|
|
||||||
|
theme = helpers.defaultNullOpts.mkStr "wave" ''
|
||||||
|
The theme to load when background is not set.
|
||||||
|
'';
|
||||||
|
|
||||||
|
background = {
|
||||||
|
light = helpers.defaultNullOpts.mkStr "lotus" ''
|
||||||
|
The theme to use when `vim.o.background = "light"`.
|
||||||
|
'';
|
||||||
|
|
||||||
|
dark = helpers.defaultNullOpts.mkStr "wave" ''
|
||||||
|
The theme to use when `vim.o.background = "dark"`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
settingsExample = {
|
||||||
|
compile = false;
|
||||||
|
undercurl = true;
|
||||||
|
commentStyle.italic = true;
|
||||||
|
functionStyle = {};
|
||||||
|
transparent = false;
|
||||||
|
dimInactive = false;
|
||||||
|
terminalColors = true;
|
||||||
|
colors = {
|
||||||
|
theme = {
|
||||||
|
wave.ui.float.bg = "none";
|
||||||
|
dragon.syn.parameter = "yellow";
|
||||||
|
all.ui.bg_gutter = "none";
|
||||||
|
};
|
||||||
|
palette = {
|
||||||
|
sumiInk0 = "#000000";
|
||||||
|
fujiWhite = "#FFFFFF";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
overrides = "function(colors) return {} end";
|
||||||
config = let
|
theme = "wave";
|
||||||
setupOptions = with cfg;
|
|
||||||
{
|
|
||||||
inherit
|
|
||||||
compile
|
|
||||||
undercurl
|
|
||||||
commentStyle
|
|
||||||
functionStyle
|
|
||||||
keywordStyle
|
|
||||||
statementStyle
|
|
||||||
typeStyle
|
|
||||||
transparent
|
|
||||||
dimInactive
|
|
||||||
terminalColors
|
|
||||||
;
|
|
||||||
colors = with colors; {
|
|
||||||
inherit theme palette;
|
|
||||||
};
|
|
||||||
overrides =
|
|
||||||
helpers.ifNonNull' overrides
|
|
||||||
(helpers.mkRaw ''
|
|
||||||
function(colors)
|
|
||||||
${overrides}
|
|
||||||
end
|
|
||||||
'');
|
|
||||||
inherit theme;
|
|
||||||
background = with background; {
|
|
||||||
inherit light dark;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// cfg.extraOptions;
|
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
|
||||||
colorscheme = "kanagawa";
|
|
||||||
|
|
||||||
extraPlugins = [cfg.package];
|
|
||||||
|
|
||||||
extraConfigLuaPre = ''
|
|
||||||
require("kanagawa").setup(${helpers.toLuaObject setupOptions})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,53 +3,57 @@
|
||||||
colorschemes.kanagawa.enable = true;
|
colorschemes.kanagawa.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
default = {
|
defaults = {
|
||||||
colorschemes.kanagawa = {
|
colorschemes.kanagawa = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
compile = false;
|
settings = {
|
||||||
undercurl = true;
|
compile = false;
|
||||||
commentStyle = {italic = true;};
|
undercurl = true;
|
||||||
functionStyle = {};
|
commentStyle = {italic = true;};
|
||||||
keywordStyle = {italic = true;};
|
functionStyle = {};
|
||||||
statementStyle = {bold = true;};
|
keywordStyle = {italic = true;};
|
||||||
typeStyle = {};
|
statementStyle = {bold = true;};
|
||||||
transparent = false;
|
typeStyle = {};
|
||||||
dimInactive = false;
|
transparent = false;
|
||||||
terminalColors = true;
|
dimInactive = false;
|
||||||
colors = {
|
terminalColors = true;
|
||||||
theme = {
|
colors = {
|
||||||
wave = {
|
theme = {
|
||||||
ui = {
|
wave = {
|
||||||
float = {
|
ui = {
|
||||||
bg = "none";
|
float = {
|
||||||
|
bg = "none";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
dragon = {
|
||||||
|
syn = {
|
||||||
|
parameter = "yellow";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
all = {
|
||||||
|
ui = {
|
||||||
|
bg_gutter = "none";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
dragon = {
|
palette = {
|
||||||
syn = {
|
sumiInk0 = "#000000";
|
||||||
parameter = "yellow";
|
fujiWhite = "#FFFFFF";
|
||||||
};
|
|
||||||
};
|
|
||||||
all = {
|
|
||||||
ui = {
|
|
||||||
bg_gutter = "none";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
palette = {
|
overrides = ''
|
||||||
sumiInk0 = "#000000";
|
function(colors)
|
||||||
fujiWhite = "#FFFFFF";
|
return {}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
theme = "wave";
|
||||||
|
background = {
|
||||||
|
light = "lotus";
|
||||||
|
dark = "wave";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
overrides = ''
|
|
||||||
return {}
|
|
||||||
'';
|
|
||||||
theme = "wave";
|
|
||||||
background = {
|
|
||||||
light = "lotus";
|
|
||||||
dark = "wave";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue