Important
v1 was just released. To transfer your config to v1, use Migration guidelines, or, if you don't want to switch now, lock the version of this plugin to v0 (or pin to commit ba89cdf).
A colorscheme for Neovim. Pleasant and productive, with stronger highlights on important keywords.
-
Multiple colorsets: Each colorset presents a unique visual theme while adhering to the same set of productive highlight rules. Every colorset can be customised.
-
Layered backgrounds: Most UI elements have backgrounds with different shades of the background color and have no borders. This allows for easy differentiation between the relative importance of the elements and keeps the colorscheme looking minimal.
-
Oklab color space: To truly achieve perceptually uniform variations of colors, all color modifications are done in this color space; thanks to mini.colors project for the code and idea.
-
Small number of colors: Colorsets use a small number of colors to provide distraction-free coding experience.
-
Stronger highlights on important keywords: Keywords related to control flow have stronger highlights, making it easier to quickly understand the code.
- Treesitter
- Native LSP
- Telescope
- NvimTree
- Neo-Tree
- Nvim-cmp
- Blink.cmp
- Indent Blankline
- Startify
- Gitsigns
- Neorg
- Nvim-notify
- Aerial
- Neotest
- Lazy
- Mason
Example with packer.nvim:
use({
"ramojus/mellifluous.nvim",
-- version = "v0.*", -- uncomment for stable config (some features might be missed if/when v1 comes out)
config = function()
require("mellifluous").setup({}) -- optional, see configuration section.
vim.cmd("colorscheme mellifluous")
end,
})
Here is the default config. The default config doesn't include all of the options – below is the documentation that describes more options. To set or override any of the options, use the setup
function, e.g.:
require("mellifluous").setup({
styles = { -- see :h attr-list for options. set {} for NONE, { option = true } for option
main_keywords = { bold = true },
},
})
For light theme, set vim.opt.background
to "light"
. This will only work on colorsets that have light theme.
Non-original colorsets are made to match their original version as closely as possible with the same highlight rules as mellifluous.
These colorsets don't get loaded, unless you specify them in a colorset
option, so there is no performance impact.
Available colorsets:
mellifluous
. Dark and light, original.alduin
. Dark, link to original.mountain
. Dark, link to original.tender
. Dark, link to original.kanagawa_dragon
. Dark, link to original.
Default config:
require("mellifluous").setup({
mellifluous = {
neutral = true, -- set this to false for original mellifluous (when it was called meliora theme)
},
})
The following snippet shows where and which colors can be overridden:
require("mellifluous").setup({
<colorset_name> = { -- name any of the defined colorsets
color_overrides = {
dark = { -- for dark theme
bg = function(bg) -- bg is used for bg shades and may be used for some colorset colors
return <new bg>
end,
colors = function(colors)
return {
<new colors> -- check "Available colors" section for colors that can be used and overriden.
}
end,
},
light = { -- for light theme
-- same keys as in dark variant
},
},
},
})
To override colors for all colorsets, omit <colorset_name>
table.
NOTE: parameter colors
will have all of the colors set by the colorset, but it will not have shades.
Example:
require("mellifluous").setup({
-- invert bg shades for all colorsets
color_overrides = {
dark = {
colors = function(colors)
return {
bg2 = colors.bg:darkened(2),
bg3 = colors.bg:darkened(4),
bg4 = colors.bg:darkened(6),
bg5 = colors.bg:darkened(8),
}
end,
}
},
-- modify some colors for mellifluous colorset
mellifluous = {
color_overrides = {
dark = {
bg = function(bg)
return bg:lightened(2)
end,
colors = function(colors)
return {
main_keywords = "#e0e066",
operators = colors.functions:desaturated(10),
}
end,
},
},
},
})
The following snippet shows how highlight overrides can be defined:
require("mellifluous").setup({
-- highlight overrides for all colorsets
highlight_overrides = {
dark = function(highlighter, colors) -- dark theme
-- set highlights here (using highlighter)
end,
light = function(highlighter, colors) -- light theme
-- set highlights here (using highlighter)
end,
},
-- highlight overrides for specific colorset
<colorset_name> = {
highlight_overrides = {
dark = function(highlighter, colors) -- dark variant of the colorset
-- set highlights here (using highlighter)
end,
light = function(highlighter, colors) -- light variant of the colorset
-- set highlights here (using highlighter)
end,
},
},
})
For an example on how to set the highlights, check the source code for general highlights, where M.set
function has the same signature as dark
or light
functions seen above. A detailed documentation is provided below.
This is the signature to set a highlight:
highlighter.set(name, definition_map)
Parameters:
name
: highlight group name in string formatdefinition_map
: highlight definition map in table format, the supported keys can be found in:h nvim_set_hl
. Keysfg
,bg
andsp
can also be set to any of the available colors (see available colors).
To get an existing highlight, use this function:
highlighter.get(name)
This function returns highlight definition map for highlight group with the requested name.
Named colors are used several times in configuration (as parameter colors
of some function). This section lists and explains those colors.
Available colors:
- Syntax element colors
main_keywords
: used to indicate keywords related to control flow.other_keywords
types
operators
strings
functions
constants
comments
fg
: in code -- identifiers.bg
- Named colors: used for terminal colors, but most of these colors will match some syntax element color.
red
orange
green
blue
purple
yellow
- Shades: colors that are derived from colors defined in the colorset (those listed above).
- UI colors: same as named colors, but all are of the same brightness (lightness).
ui_red
: used to indicate errors, deletes, bad spellings.ui_orange
: used to indicate warnings, changes, other (strange) spellings.ui_green
: used to indicate staged, additions.ui_blue
: used to indicate information, new files.ui_purple
: used to indicate hints, merge.ui_yellow
- Shades of fg and bg colors. These colors might be used for more than explained below.
fg2
: used for statusline, normal text in plugins that open in split windows.fg3
: used for folded text.fg4
: used for line numbers.fg5
: used for active indent line, "hidden" text.dark_bg
: used for background in plugins that open in split windows.bg2
: used for cursorline/column, some floating windows.bg3
: used for folded text background, floating windows, showing LSP references.bg4
: used for visual mode, completion menu, statusline, fg of inactive indent line.bg5
(only for dark background): indicates a more prominent selection than visual, might be deprecated in the future.dark_bg2
(only for light background): used as a replacement for bg5 and also for visual mode
- UI colors: same as named colors, but all are of the same brightness (lightness).
Some colorsets may have more colors available. To check that, refer to the source of the colorset.
Every color from available colors has the following meta functions (accessed with :
operator):
lightened(val)
: returns color withval
added current to lightness.darkened(val)
: returns color withval
subtracted from current lightness.with_lightness(val)
: returns color with specified lightness, whereval
can be from 0 to 100.saturated(val)
: returns color withval
added to current saturation.desaturated(val)
: returns color withval
subtracted from current saturation.with_saturation(val)
: returns color with specified saturation, whereval
can be from 0 to 100.
To create your own color that has the same functions available, use require("mellifluous.color").new(hex_value)
function.
Type :Mellifluous <TAB>
and see the available options.
Options include:
- Toggling transparency.
- Changing colorset.
- Support more plugins (contributions are welcome).