diff --git a/plugins/colorschemes/everforest.nix b/plugins/colorschemes/everforest.nix new file mode 100644 index 00000000..cfbeba7f --- /dev/null +++ b/plugins/colorschemes/everforest.nix @@ -0,0 +1,265 @@ +{ + lib, + helpers, + config, + pkgs, + ... +}: +let + mkEverforestBool = + pluginDefault: desc: + helpers.defaultNullOpts.mkEnum [ + 0 + 1 + ] pluginDefault desc; + +in +helpers.vim-plugin.mkVimPlugin config { + name = "everforest"; + isColorscheme = true; + defaultPackage = pkgs.vimPlugins.everforest; + globalPrefix = "everforest_"; + + maintainers = [ helpers.maintainers.sheemap ]; + + settingsOptions = { + background = + helpers.defaultNullOpts.mkEnum + [ + "hard" + "medium" + "soft" + ] + "medium" + '' + The background contrast used in this color scheme. + ''; + + enable_italic = mkEverforestBool 0 '' + To enable italic in this color scheme, set this option to `1`. + ''; + + disable_italic_comment = mkEverforestBool 0 '' + By default, italic is enabled in `Comment`. To disable italic in `Comment`, set this option to `1` + ''; + + cursor = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + "auto" + "red" + "orange" + "yellow" + "green" + "aqua" + "blue" + "purple" + ] + '' + Customize the cursor color, only works in GUI clients. + ''; + + transparent_background = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + 0 + 1 + 2 + ] + '' + To use transparent background, set this option to `1`. + + If you want more ui components to be transparent (for example, status line + background), set this option to `2`. + ''; + + dim_inactive_windows = mkEverforestBool 0 '' + Dim inactive windows. Only works in Neovim currently. + + When this option is used in conjunction with |g:everforest_show_eob| set to 0, + the end of the buffer will only be hidden inside the active window. Inside + inactive windows, the end of buffer filler characters will be visible in + dimmed symbols. This is due to the way Vim and Neovim handle |hl-EndOfBuffer|. + ''; + + sign_column_background = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + "none" + "grey" + ] + '' + By default, the color of sign column background is the same as normal text + background, but you can use a grey background by setting this option to `'grey'`. + ''; + + spell_foreground = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + "none" + "colored" + ] + '' + By default, this color scheme won't color the foreground of |spell|, instead + colored under curls will be used. If you also want to color the foreground, + set this option to `'colored'`. + ''; + + ui_contrast = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + "low" + "high" + ] + '' + The contrast of line numbers, indent lines, etc. + ''; + + show_eob = mkEverforestBool 1 '' + Whether to show |hl-EndOfBuffer|. + ''; + + float_style = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + "bright" + "dim" + ] + '' + Style used to make floating windows stand out from other windows. `'bright'` + makes the background of these windows lighter than |hl-Normal|, whereas + `'dim'` makes it darker. + + Floating windows include for instance diagnostic pop-ups, scrollable + documentation windows from completion engines, overlay windows from + installers, etc. + ''; + + diagnostic_text_highlight = mkEverforestBool 0 '' + Some plugins support highlighting error/warning/info/hint texts, by default + these texts are only underlined, but you can use this option to also highlight + the background of them. + + Currently, the following plugins are supported: + + - neovim's built-in language server client + - [coc.nvim](https://github.com/neoclide/coc.nvim) + - [vim-lsp](https://github.com/prabirshrestha/vim-lsp) + - [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe) + - [ale](https://github.com/dense-analysis/ale) + - [neomake](https://github.com/neomake/neomake) + - [syntastic](https://github.com/vim-syntastic/syntastic) + ''; + + diagnostic_line_highlight = mkEverforestBool 0 '' + Some plugins support highlighting error/warning/info/hint lines, but this + feature is disabled by default in this color scheme. To enable this feature, + set this option to `1`. + + Currently, the following plugins are supported: + + - [coc.nvim](https://github.com/neoclide/coc.nvim) + - [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe) + - [ale](https://github.com/dense-analysis/ale) + - [syntastic](https://github.com/vim-syntastic/syntastic) + ''; + + diagnostic_virtual_text = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + "grey" + "colored" + "highlighted" + ] + '' + Some plugins can use the virtual text feature of Neovim to display + error/warning/info/hint information. You can use this option to adjust the + way these virtual texts are highlighted. + + Currently, the following plugins are supported: + + - Neovim's built-in language server client + - [coc.nvim](https://github.com/neoclide/coc.nvim) + - [vim-lsp](https://github.com/prabirshrestha/vim-lsp) + - [ale](https://github.com/dense-analysis/ale) + - [neomake](https://github.com/neomake/neomake) + - [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe) + ''; + + current_word = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + "grey background" + "bold" + "underline" + "italic" + ] + '' + Some plugins can highlight the word under current cursor, you can use this + option to control their behavior. + + Default value: `'grey background'` when not in transparent mode, `'bold'` + when in transparent mode. + + Currently, the following plugins are supported: + + - [coc-highlight](https://github.com/neoclide/coc-highlight) + - [vim_current_word](https://github.com/dominikduda/vim_current_word) + - [vim-illuminate](https://github.com/RRethy/vim-illuminate) + - [vim-cursorword](https://github.com/itchyny/vim-cursorword) + - [vim-lsp](https://github.com/prabirshrestha/vim-lsp) + ''; + + inlay_hints_background = + helpers.defaultNullOpts.mkEnumFirstDefault + [ + "none" + "dimmed" + ] + '' + Inlay hints are special markers that are displayed inline with the code to + provide you with additional information. You can use this option to customize + the background color of inlay hints. + + Currently, the following LSP clients are supported: + + - Neovim's built-in language server client + - [coc.nvim](https://github.com/neoclide/coc.nvim) + - [vim-lsp](https://github.com/prabirshrestha/vim-lsp) + - [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe) + ''; + + disable_terminal_colors = mkEverforestBool 0 '' + Setting this option to `1` will disable terminal colors provided by this color + scheme so you can remain terminal colors the same when using |:terminal| in + vim and outside of vim. + ''; + + lightline_disable_bold = mkEverforestBool 0 '' + By default, bold is enabled in lightline color scheme. To disable bold in + lightline color scheme, set this option to `1`. + ''; + + colors_override = helpers.defaultNullOpts.mkAttrsOf (lib.types.listOf lib.types.str) { } '' + Override color palette. The available keys can be found in the plugin's [source code](https://github.com/sainnhe/everforest/blob/master/autoload/everforest.vim) + ''; + + }; + + settingsExample = { + background = "hard"; + dim_inactive_windows = 1; + colors_override = { + bg0 = [ + "#202020" + "234" + ]; + bg2 = [ + "#282828" + "235" + ]; + }; + }; + + extraConfig = cfg: { opts.termguicolors = lib.mkDefault true; }; +} diff --git a/plugins/default.nix b/plugins/default.nix index 5c9e24c5..155fc3a2 100644 --- a/plugins/default.nix +++ b/plugins/default.nix @@ -12,6 +12,7 @@ ./colorschemes/catppuccin.nix ./colorschemes/cyberdream.nix ./colorschemes/dracula.nix + ./colorschemes/everforest.nix ./colorschemes/gruvbox.nix ./colorschemes/kanagawa.nix ./colorschemes/melange.nix diff --git a/tests/test-sources/plugins/colorschemes/everforest.nix b/tests/test-sources/plugins/colorschemes/everforest.nix new file mode 100644 index 00000000..79b5b79c --- /dev/null +++ b/tests/test-sources/plugins/colorschemes/everforest.nix @@ -0,0 +1,77 @@ +{ + empty = { + colorschemes.everforest.enable = true; + }; + + defaults = { + colorschemes.everforest = { + enable = true; + + settings = { + background = "medium"; + enable_italic = 0; + disable_italic_comment = 0; + cursor = "auto"; + transparent_background = 0; + dim_inactive_windows = 0; + sign_column_background = "none"; + spell_foreground = "none"; + ui_contrast = "low"; + show_eob = 1; + float_style = "bright"; + diagnostic_text_highlight = 0; + diagnostic_line_highlight = 0; + diagnostic_virtual_text = "grey"; + current_word = "grey background"; + inlay_hints_background = "none"; + disable_terminal_colors = 0; + lightline_disable_bold = 0; + colors_override = { }; + + # This option is broken when set to 1, because the plugin tries to write its cache in /nix/store + better_performance = 0; + }; + }; + }; + + nonDefaults = { + colorschemes.everforest = { + enable = true; + + settings = { + background = "hard"; + enable_italic = 1; + disable_italic_comment = 1; + cursor = "red"; + transparent_background = 1; + dim_inactive_windows = 1; + sign_column_background = "grey"; + spell_foreground = "colored"; + ui_contrast = "high"; + show_eob = 0; + float_style = "dim"; + diagnostic_text_highlight = 1; + diagnostic_line_highlight = 1; + diagnostic_virtual_text = "colored"; + current_word = "bold"; + inlay_hints_background = "dimmed"; + disable_terminal_colors = 1; + lightline_disable_bold = 1; + + # This option is broken, because the plugin tries to write its cache in /nix/store + # better_performance = 1; + + colors_override = { + bg0 = [ + "#202020" + "234" + ]; + bg2 = [ + "#282828" + "235" + ]; + }; + }; + }; + }; +}