mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
colorschemes/rose-pine: switch to mkNeovimPlugin
This commit is contained in:
parent
16272920e2
commit
d5a309286d
2 changed files with 179 additions and 69 deletions
|
@ -1,54 +1,141 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
helpers,
|
||||||
config,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib;
|
||||||
cfg = config.colorschemes.rose-pine;
|
helpers.neovim-plugin.mkNeovimPlugin config {
|
||||||
in {
|
name = "rose-pine";
|
||||||
options = {
|
isColorscheme = true;
|
||||||
colorschemes.rose-pine = {
|
defaultPackage = pkgs.vimPlugins.rose-pine;
|
||||||
enable = mkEnableOption "rose-pine";
|
|
||||||
|
|
||||||
package = helpers.mkPackageOption "rose-pine" pkgs.vimPlugins.rose-pine;
|
maintainers = [maintainers.GaetanLepage];
|
||||||
|
|
||||||
style = helpers.defaultNullOpts.mkEnumFirstDefault ["main" "moon" "dawn"] "Theme style";
|
# TODO introduced 2024-04-15: remove 2024-06-15
|
||||||
|
optionsRenamedToSettings = [
|
||||||
|
"groups"
|
||||||
|
"highlightGroups"
|
||||||
|
];
|
||||||
|
imports = let
|
||||||
|
basePluginPath = ["colorschemes" "rose-pine"];
|
||||||
|
in [
|
||||||
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(basePluginPath ++ ["style"])
|
||||||
|
(basePluginPath ++ ["settings" "dark_variant"])
|
||||||
|
)
|
||||||
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(basePluginPath ++ ["dimInactive"])
|
||||||
|
(basePluginPath ++ ["settings" "dim_inactive_windows"])
|
||||||
|
)
|
||||||
|
(
|
||||||
|
mkRemovedOptionModule
|
||||||
|
(basePluginPath ++ ["disableItalics"])
|
||||||
|
"Use `colorschemes.rose-pine.settings.enable.italics` instead."
|
||||||
|
)
|
||||||
|
(
|
||||||
|
mkRemovedOptionModule
|
||||||
|
(basePluginPath ++ ["boldVerticalSplit"])
|
||||||
|
"Use `colorschemes.rose-pine.settings.highlight_groups` instead."
|
||||||
|
)
|
||||||
|
(
|
||||||
|
mkRemovedOptionModule
|
||||||
|
(basePluginPath ++ ["transparentFloat"])
|
||||||
|
"Use `colorschemes.rose-pine.settings.highlight_groups.NormalFloat` instead."
|
||||||
|
)
|
||||||
|
(
|
||||||
|
mkRenamedOptionModule
|
||||||
|
(basePluginPath ++ ["transparentBackground"])
|
||||||
|
(basePluginPath ++ ["settings" "enable" "transparency"])
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
boldVerticalSplit = helpers.defaultNullOpts.mkBool false "Bolds vertical splits";
|
settingsOptions = {
|
||||||
|
variant = helpers.mkNullOrOption (types.enum ["auto" "main" "moon" "dawn"]) ''
|
||||||
|
Set the desired variant: "auto" will follow the vim background, defaulting to `dark_variant`
|
||||||
|
or "main" for dark and "dawn" for light.
|
||||||
|
'';
|
||||||
|
|
||||||
dimInactive = helpers.defaultNullOpts.mkBool false "Dims inactive windows";
|
dark_variant = helpers.defaultNullOpts.mkEnumFirstDefault ["main" "moon" "dawn"] ''
|
||||||
|
Set the desired dark variant when `settings.variant` is set to "auto".
|
||||||
|
'';
|
||||||
|
|
||||||
disableItalics = helpers.defaultNullOpts.mkBool false "Disables italics";
|
dim_inactive_windows = helpers.defaultNullOpts.mkBool false ''
|
||||||
|
Differentiate between active and inactive windows and panels.
|
||||||
|
'';
|
||||||
|
|
||||||
groups = helpers.mkNullOrOption types.attrs "rose-pine highlight groups";
|
extend_background_behind_borders = helpers.defaultNullOpts.mkBool true ''
|
||||||
|
Extend background behind borders.
|
||||||
|
Appearance differs based on which border characters you are using.
|
||||||
|
'';
|
||||||
|
|
||||||
highlightGroups = helpers.mkNullOrOption types.attrs "Custom highlight groups";
|
enable = {
|
||||||
|
legacy_highlights = helpers.defaultNullOpts.mkBool true "Enable legacy highlights.";
|
||||||
|
|
||||||
transparentBackground = helpers.defaultNullOpts.mkBool false "Disable setting background";
|
migrations = helpers.defaultNullOpts.mkBool true "Enable migrations.";
|
||||||
|
|
||||||
transparentFloat = helpers.defaultNullOpts.mkBool false "Disable setting background for floating windows";
|
terminal = helpers.defaultNullOpts.mkBool true "Enable terminal.";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
styles = {
|
||||||
colorscheme = "rose-pine";
|
bold = helpers.defaultNullOpts.mkBool true "Enable bold.";
|
||||||
extraPlugins = [cfg.package];
|
|
||||||
opts.termguicolors = true;
|
italic = helpers.defaultNullOpts.mkBool true "Enable italic.";
|
||||||
extraConfigLuaPre = let
|
|
||||||
setupOptions = with cfg; {
|
transparency = helpers.defaultNullOpts.mkBool true "Enable transparency.";
|
||||||
inherit groups;
|
|
||||||
dark_variant = style;
|
|
||||||
bold_vert_split = boldVerticalSplit;
|
|
||||||
disable_background = transparentBackground;
|
|
||||||
disable_float_background = transparentFloat;
|
|
||||||
disable_italics = disableItalics;
|
|
||||||
dim_nc_background = dimInactive;
|
|
||||||
highlight_groups = highlightGroups;
|
|
||||||
};
|
};
|
||||||
in ''
|
|
||||||
require("rose-pine").setup(${helpers.toLuaObject setupOptions})
|
groups = helpers.mkNullOrOption (with types; attrsOf (either str (attrsOf str))) ''
|
||||||
|
Highlight groups.
|
||||||
|
|
||||||
|
default: see [source](https://github.com/rose-pine/neovim/blob/main/lua/rose-pine/config.lua)
|
||||||
|
'';
|
||||||
|
|
||||||
|
highlight_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight "{}" ''
|
||||||
|
Custom highlight groups.
|
||||||
|
'';
|
||||||
|
|
||||||
|
before_highlight = helpers.defaultNullOpts.mkLuaFn "function(group, highlight, palette) end" ''
|
||||||
|
Called before each highlight group, before setting the highlight.
|
||||||
|
|
||||||
|
`function(group, highlight, palette)`
|
||||||
|
|
||||||
|
```lua
|
||||||
|
@param group string
|
||||||
|
@param highlight Highlight
|
||||||
|
@param palette Palette
|
||||||
|
```
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
settingsExample = {
|
||||||
|
variant = "auto";
|
||||||
|
dark_variant = "moon";
|
||||||
|
dim_inactive_windows = true;
|
||||||
|
extend_background_behind_borders = true;
|
||||||
|
enable = {
|
||||||
|
legacy_highlights = false;
|
||||||
|
migrations = true;
|
||||||
|
terminal = false;
|
||||||
|
};
|
||||||
|
styles = {
|
||||||
|
bold = false;
|
||||||
|
italic = true;
|
||||||
|
transparency = true;
|
||||||
|
};
|
||||||
|
groups = {
|
||||||
|
border = "muted";
|
||||||
|
link = "iris";
|
||||||
|
panel = "surface";
|
||||||
|
};
|
||||||
|
highlight_groups = {};
|
||||||
|
before_highlight = "function(group, highlight, palette) end";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = cfg: {
|
||||||
|
opts.termguicolors = mkDefault true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -6,24 +6,48 @@
|
||||||
defaults = {
|
defaults = {
|
||||||
colorschemes.rose-pine = {
|
colorschemes.rose-pine = {
|
||||||
enable = true;
|
enable = true;
|
||||||
style = "main";
|
|
||||||
boldVerticalSplit = false;
|
settings = {
|
||||||
dimInactive = false;
|
variant = "auto";
|
||||||
disableItalics = false;
|
dark_variant = "main";
|
||||||
|
dim_inactive_windows = false;
|
||||||
|
extend_background_behind_borders = true;
|
||||||
|
|
||||||
|
enable = {
|
||||||
|
legacy_highlights = true;
|
||||||
|
migrations = true;
|
||||||
|
terminal = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
styles = {
|
||||||
|
bold = true;
|
||||||
|
italic = true;
|
||||||
|
transparency = true;
|
||||||
|
};
|
||||||
|
|
||||||
groups = {
|
groups = {
|
||||||
background = "base";
|
border = "muted";
|
||||||
background_nc = "_experimental_nc";
|
|
||||||
panel = "surface";
|
|
||||||
panel_nc = "base";
|
|
||||||
border = "highlight_med";
|
|
||||||
comment = "muted";
|
|
||||||
link = "iris";
|
link = "iris";
|
||||||
punctuation = "subtle";
|
panel = "surface";
|
||||||
|
|
||||||
error = "love";
|
error = "love";
|
||||||
hint = "iris";
|
hint = "iris";
|
||||||
info = "foam";
|
info = "foam";
|
||||||
|
note = "pine";
|
||||||
|
todo = "rose";
|
||||||
warn = "gold";
|
warn = "gold";
|
||||||
headings = {
|
|
||||||
|
git_add = "foam";
|
||||||
|
git_change = "rose";
|
||||||
|
git_delete = "love";
|
||||||
|
git_dirty = "rose";
|
||||||
|
git_ignore = "muted";
|
||||||
|
git_merge = "iris";
|
||||||
|
git_rename = "pine";
|
||||||
|
git_stage = "iris";
|
||||||
|
git_text = "rose";
|
||||||
|
git_untracked = "subtle";
|
||||||
|
|
||||||
h1 = "iris";
|
h1 = "iris";
|
||||||
h2 = "foam";
|
h2 = "foam";
|
||||||
h3 = "rose";
|
h3 = "rose";
|
||||||
|
@ -31,9 +55,8 @@
|
||||||
h5 = "pine";
|
h5 = "pine";
|
||||||
h6 = "foam";
|
h6 = "foam";
|
||||||
};
|
};
|
||||||
};
|
highlight_groups = {
|
||||||
highlightGroups = {
|
ColorColumn.bg = "rose";
|
||||||
ColorColumn = {bg = "rose";};
|
|
||||||
CursorLine = {
|
CursorLine = {
|
||||||
bg = "foam";
|
bg = "foam";
|
||||||
blend = 10;
|
blend = 10;
|
||||||
|
@ -44,8 +67,8 @@
|
||||||
blend = 10;
|
blend = 10;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
transparentBackground = false;
|
before_highlight = "function(group, highlight, palette) end";
|
||||||
transparentFloat = false;
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue