This is my take on a lua port of srcery-vim. Keep in mind this is an opinionated rendition of srcery, so it might change whenever my preferences change, but you can override any highlights, so theoretically that shouldn't be a problem.
- Extensible.
- Integrations with a bunch of plugins (you're welcome to PR more):
Use whatever plugin manager you like, here are some examples:
Plug 'DanisDGK/srcery.nvim'
use("DanisDGK/srcery.nvim")
Plugin 'DanisDGK/srcery.nvim'
The defaults are minimal, so you'll probably want to enable some extras. For reference, these are the defaults:
transparent_background = false,
term_colors = true,
styles = {
comments = "italic",
functions = "italic",
keywords = "italic",
strings = "NONE",
variables = "NONE",
},
integrations = {
gitgutter = false,
gitsigns = false,
indent_blankline = {
enabled = false,
colored_indent_levels = false,
},
lsp_saga = false,
lsp_trouble = false,
native_lsp = {
enabled = true,
virtual_text = {
errors = "italic",
hints = "italic",
warnings = "italic",
information = "italic",
},
underlines = {
errors = "underline",
hints = "underline",
warnings = "underline",
information = "underline",
},
},
neogit = false,
notify = false,
telescope = false,
treesitter = true,
ts_rainbow = false,
which_key = false,
}
The way to change the settings varies based on whether you're using Vimscript or Lua in your configuration.
require("srcery").setup(<settings>)
lua << EOF
require("srcery").setup(<settings>)
EOF
After you've changed the settings to your liking, you can load the colorscheme like so:
vim.cmd[[colorscheme srcery]]
colorscheme srcery
Although the settings should be mostly self-explanatory, here is exactly what they do.
Settings that don't fit in the other groups.
transparent_background
: (Boolean) if true, disables the background.term_colors
: (Boolean) if true, sets terminal colors (:h terminal-config
).
Handles the styles of general highlight groups (:h highlight-args
)
comments
: (String) changes the style of comments.functions
: (String) changes the style of functions.keywords
: (String) changes the style of keywords.strings
: (String) changes the style of strings.variables
: (String) changes the style of variables.
The integrations change the highlight groups (read: theme) of the plugin/feature. To enable one, simply set it to true
.
enabled
: (Boolean) sets the regular indent character color.colored_indent_levels
: (Boolean) sets indent character colors per indent level. Follow the instructions here to enable them in the plugin.
enabled
: (Boolean) sets the LSP diagnostic colors.virtual_text/underlines
errors
: (String) changes the style of errors.hints
: (String) changes the style of hints.warnings
: (String) changes the style of warnings.information
: (String) changes the style of info.
virtual_text
changes the style of the diagnostic text
underlines
changes the style of the text producing the error
There are also some which are not enabled by changing srcery.nvim
settings:
require("lualine").setup {
options = {
theme = "srcery"
}
}
The API allows you to fetch the color palette from srcery.nvim. It can be required as such.
local colors = require("srcery.api.colors").get_colors()
Returns a table of colors, where the key is the name and the value is the color's hex value.
You can overwrite highlight groups like so:
srcery.remap({ <hi_group> = { <fields> }, })
Example:
local colors = require("srcery.api.colors").get_colors() -- fetch color palette
srcery.remap({ Comment = { fg = colors.red }, })
Use them to execute code at certain events. These are the available ones:
Function | Description |
---|---|
before_loading() |
Executed before loading the colorscheme |
after_loading() |
Executed after loading the colorscheme |
Example:
local srcery = require("srcery")
srcery.before_loading = function()
print("Hello from before srcery")
end
- Pocco81 for their Catppuccin colorscheme which I shamelessly stole the structure from
- Srcery for the color palette