diff --git a/plugins/colorschemes/rose-pine.nix b/plugins/colorschemes/rose-pine.nix new file mode 100644 index 00000000..11dd26a3 --- /dev/null +++ b/plugins/colorschemes/rose-pine.nix @@ -0,0 +1,54 @@ +{ + pkgs, + config, + lib, + ... +} @ args: +with lib; let + cfg = config.colorschemes.rose-pine; + helpers = import ../helpers.nix args; +in { + options = { + colorschemes.rose-pine = { + enable = mkEnableOption "rose-pine"; + + package = helpers.mkPackageOption "rose-pine" pkgs.vimPlugins.rose-pine; + + style = helpers.defaultNullOpts.mkEnumFirstDefault ["main" "moon" "dawn"] "Theme style"; + + boldVerticalSplit = helpers.defaultNullOpts.mkBool false "Bolds vertical splits"; + + dimInactive = helpers.defaultNullOpts.mkBool false "Dims inactive windows"; + + disableItalics = helpers.defaultNullOpts.mkBool false "Disables italics"; + + groups = helpers.mkNullOrOption types.attrs "rose-pine highlight groups"; + + highlightGroups = helpers.mkNullOrOption types.attrs "Custom highlight groups"; + + transparentBackground = helpers.defaultNullOpts.mkBool false "Disable setting background"; + + transparentFloat = helpers.defaultNullOpts.mkBool false "Disable setting background for floating windows"; + }; + }; + + config = mkIf cfg.enable { + colorscheme = "rose-pine"; + extraPlugins = [cfg.package]; + options = {termguicolors = true;}; + extraConfigLuaPre = let + setupOptions = with cfg; { + 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}) + ''; + }; +} diff --git a/plugins/default.nix b/plugins/default.nix index 2156c3bc..76ac9aaf 100644 --- a/plugins/default.nix +++ b/plugins/default.nix @@ -11,6 +11,7 @@ ./colorschemes/poimandres.nix ./colorschemes/tokyonight.nix ./colorschemes/catppuccin.nix + ./colorschemes/rose-pine.nix ./completion/coq.nix ./completion/coq-thirdparty.nix diff --git a/tests/test-sources/plugins/colorschemes/rose-pine.nix b/tests/test-sources/plugins/colorschemes/rose-pine.nix new file mode 100644 index 00000000..8a3d0afa --- /dev/null +++ b/tests/test-sources/plugins/colorschemes/rose-pine.nix @@ -0,0 +1,51 @@ +{ + empty = { + colorschemes.rose-pine.enable = true; + }; + + defaults = { + colorschemes.rose-pine = { + enable = true; + style = "main"; + boldVerticalSplit = false; + dimInactive = false; + disableItalics = false; + groups = { + background = "base"; + background_nc = "_experimental_nc"; + panel = "surface"; + panel_nc = "base"; + border = "highlight_med"; + comment = "muted"; + link = "iris"; + punctuation = "subtle"; + error = "love"; + hint = "iris"; + info = "foam"; + warn = "gold"; + headings = { + h1 = "iris"; + h2 = "foam"; + h3 = "rose"; + h4 = "gold"; + h5 = "pine"; + h6 = "foam"; + }; + }; + highlightGroups = { + ColorColumn = {bg = "rose";}; + CursorLine = { + bg = "foam"; + blend = 10; + }; + StatusLine = { + fg = "love"; + bg = "love"; + blend = 10; + }; + }; + transparentBackground = false; + transparentFloat = false; + }; + }; +}