colorschemes/nord: fix

This commit is contained in:
Gaetan Lepage 2024-01-16 00:17:28 +01:00 committed by Gaétan Lepage
parent 9f2d766f28
commit c5f43a8a37
2 changed files with 92 additions and 28 deletions

View file

@ -8,36 +8,72 @@
with lib; let with lib; let
cfg = config.colorschemes.nord; cfg = config.colorschemes.nord;
in { in {
# Introduced January, 16 2024.
# TODO remove in early February 2023.
imports = let
basePluginPath = ["colorschemes" "nord"];
in [
(
mkRenamedOptionModule
(basePluginPath ++ ["disable_background"])
(basePluginPath ++ ["disableBackground"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["cursorline_transparent"])
(basePluginPath ++ ["cursorlineTransparent"])
)
(
mkRenamedOptionModule
(basePluginPath ++ ["enable_sidebar_background"])
(basePluginPath ++ ["enableSidebarBackground"])
)
];
options = { options = {
colorschemes.nord = { colorschemes.nord = {
enable = mkEnableOption "nord"; enable = mkEnableOption "nord";
package = helpers.mkPackageOption "nord.vim" pkgs.vimPlugins.nord-nvim; package = helpers.mkPackageOption "nord.nvim" pkgs.vimPlugins.nord-nvim;
contrast = contrast = helpers.defaultNullOpts.mkBool false ''
mkEnableOption Make sidebars and popup menus like nvim-tree and telescope have a different background.
"Make sidebars and popup menus like nvim-tree and telescope have a different background"; '';
borders = borders = helpers.defaultNullOpts.mkBool false ''
mkEnableOption Enable the border between verticaly split windows visable.
"Enable the border between verticaly split windows visable"; '';
disable_background = disableBackground = helpers.defaultNullOpts.mkBool false ''
mkEnableOption Disable the setting of background color so that NeoVim can use your terminal background.
"Disable the setting of background color so that NeoVim can use your terminal background"; '';
cursorline_transparent = cursorlineTransparent = helpers.defaultNullOpts.mkBool false ''
mkEnableOption Set the cursorline transparent/visible.
"Set the cursorline transparent/visible"; '';
enable_sidebar_background = enableSidebarBackground = helpers.defaultNullOpts.mkBool false ''
mkEnableOption Re-enables the background of the sidebar if you disabled the background of everything.
"Re-enables the background of the sidebar if you disabled the background of everything"; '';
italic = mkOption { italic = helpers.defaultNullOpts.mkBool true ''
description = "enables/disables italics"; Enables/disables italics.
type = types.nullOr types.bool; '';
default = null;
uniformDiffBackground = helpers.defaultNullOpts.mkBool false ''
Enables/disables colorful backgrounds when used in _diff_ mode.
'';
extraConfig = mkOption {
type = types.attrs;
description = ''
The configuration options for vimtex without the 'nord_' prefix.
Example: To set 'nord_foo_bar' to 1, write
extraConfig = {
foo_bar = true;
};
'';
default = {};
}; };
}; };
}; };
@ -46,13 +82,21 @@ in {
colorscheme = "nord"; colorscheme = "nord";
extraPlugins = [cfg.package]; extraPlugins = [cfg.package];
globals = { globals =
nord_contrast = mkIf cfg.contrast 1; mapAttrs'
nord_borders = mkIf cfg.borders 1; (name: value: nameValuePair "nord_${name}" value)
nord_disable_background = mkIf cfg.disable_background 1; (with cfg;
nord_cursoline_transparent = mkIf cfg.cursorline_transparent 1; {
nord_enable_sidebar_background = mkIf cfg.enable_sidebar_background 1; inherit
nord_italic = mkIf (cfg.italic != null) cfg.italic; contrast
}; borders
;
disable_background = disableBackground;
cursorline_transparent = cursorlineTransparent;
enable_sidebar_background = enableSidebarBackground;
inherit italic;
uniform_diff_background = uniformDiffBackground;
}
// cfg.extraConfig);
}; };
} }

View file

@ -0,0 +1,20 @@
{
empty = {
colorschemes.nord.enable = true;
};
defaults = {
colorschemes.nord = {
enable = true;
contrast = false;
borders = false;
disableBackground = false;
cursorlineTransparent = false;
enableSidebarBackground = false;
italic = true;
uniformDiffBackground = false;
extraConfig = {};
};
};
}