ramojus / mellifluous.nvim

Pleasant and productive colorscheme for Neovim
MIT License
315 stars 11 forks source link
color-scheme lua neovim neovim-colorscheme nvim theme

[!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).

Mellifluous

A colorscheme for Neovim. Pleasant and productive, with stronger highlights on important keywords. preview

Highlighted features

Styled plugins

Installation and usage

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,
})

Configuration

Here is an example with the default config. This is optional, and only relevant parts of the config can be included.

require("mellifluous").setup({
    dim_inactive = false,
    colorset = "mellifluous",
    styles = { -- see :h attr-list for options. set {} for NONE, { option = true } for option
        main_keywords = {},
        other_keywords = {},
        types = {},
        operators = {},
        strings = {},
        functions = {},
        constants = {},
        comments = { italic = true },
        markup = {
            headings = { bold = true },
        },
        folds = {},
    },
    transparent_background = {
        enabled = false,
        floating_windows = true,
        telescope = true,
        file_tree = true,
        cursor_line = true,
        status_line = false,
    },
    flat_background = {
        line_numbers = false,
        floating_windows = false,
        file_tree = false,
        cursor_line_number = false,
    },
    plugins = {
        cmp = true,
        gitsigns = true,
        indent_blankline = true,
        nvim_tree = {
            enabled = true,
            show_root = false,
        },
        neo_tree = {
            enabled = true,
        },
        telescope = {
            enabled = true,
            nvchad_like = true,
        },
        startify = true,
    },
})

Light theme

For light theme, set vim.opt.background to "light". This will only work on colorsets that have light theme.

Colorsets

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 colorset configuration

Default config:

require("mellifluous").setup({
    mellifluous = {
        neutral = true, -- set this to false for original mellifluous (when it was called meliora theme)
    },
})

Color overrides

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,
            },
        },
    },
})

Highlight overrides

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.

Highlighter usage

This is the signature to set a highlight:

highlighter.set(name, definition_map)

Parameters:

To get an existing highlight, use this function:

highlighter.get(name)

This function returns highlight definition map for highlight group with the requested name.

Available colors

Named colors are used several times in configuration (as parameter colors of some function). This section lists and explains those colors.

Available colors:

Some colorsets may have more colors available. To check that, refer to the source of the colorset.

Color functions

Every color from available colors has the following meta functions (accessed with : operator):

To create your own color that has the same functions available, use require("mellifluous.color").new(hex_value) function.

CLI options

Type :Mellifluous <TAB> and see the available options.

Options include:

TODO

Ports

Inspiration

License

MIT