Purple-hued dark mode colorscheme for Neovim
Find a file
2024-06-01 14:55:49 +10:00
colors refactor: rebrand to lavender 2024-02-16 22:22:49 +11:00
lua feat: add diagnostic signs 2024-06-01 14:49:17 +10:00
src refactor: better dict idiom in HexToCterm 2024-03-11 11:32:01 +11:00
.editorconfig docs(code): clarify and document type definitions 2024-01-27 17:51:15 +11:00
LICENSE docs: add README 2024-01-26 22:15:01 +11:00
README.md docs: update wallpaper link in README 2024-06-01 14:55:49 +10:00

Lavender

Canonical: https://codeberg.org/jthvai/lavender.nvim
Mirror: https://forge.jthv.ai/elias/lavender.nvim

Purple-hued dark mode colorscheme for Neovim.

opaque background

transparent background1

Palette inspired by atomiks/moonlight-vscode-theme; a complete rewrite of shaunsingh/moonlight.nvim, which is no longer maintained.

Features

Support is provided for each item from the listed version to the next breaking change, as well as whatever is backwards compatible from that version.

If something is wrong (particularly if highlights are missing2) with one of these, please submit an issue.

Several popular plugins are also supported. See theme.lua (about midway through) for details.

In general, I am not too keen on providing tailored support for plugins that I don't use3, as I'm unlikely to notice if something breaks or looks bad. But! It is really easy to extend this colorscheme - see Examples below.

Requirements

  • Neovim (same versions as in Features)
  • nvim-treesitter (optional)
    • I strongly recommend installing treesitter, and parsers for your favourite languages, as I will not particularly ensure that Vim's native syntax highlighting looks good for languages where treesitter queries are available, except the ones explicitly stated in Features.
  • (Optional) a patched font for custom diagnostic signs (set signs = true in the config, false by default)

Julia is not a runtime dependency.

Installation

lazy.nvim:

{
  url = "https://codeberg.org/jthvai/lavender.nvim",
  branch = "stable", -- versioned tags + docs updates from main
  lazy = false,
  priority = 1000,
}

Usage

" Vimscript
colorscheme lavender
-- Lua
vim.cmd "colorscheme lavender"

Configuration

WARNING: Do not call require("lavender").setup() — it does not exist, and is not used to configure this plugin4.

Add vim.g.lavender to init.lua or wherever else global variables may be set in lua5, e.g. lazy.nvim's config function. Do this before calling :colorscheme lavender.

-- Default config in lua
vim.g.lavender = {
  transparent = {
    background = false, -- do not render the main background
    float      = false, -- do not render the background in floating windows
    popup      = false, -- do not render the background in popup menus
    sidebar    = false, -- do not render the background in sidebars
  },
  contrast = true, -- colour the sidebar and floating windows differently to the main background

  italic = {
    comments  = true, -- italic comments
    functions = true, -- italic function names
    keywords  = false, -- italic keywords
    variables = false, -- italic variables
  },

  signs = false, -- use icon (patched font) diagnostic sign text

  -- new values will be merged in
  overrides = {
    -- highlight groups - see theme.lua
    -- existing groups will be entirely replaced
    theme = {},

    colors = {
      cterm = {}, -- cterm colours - see colors/cterm.lua
      hex = {}, -- hex (true) colours - see colors/hex.lua
    },
  },
}

Custom hex colours are not mapped to 256-color on the fly for performance reasons.

Examples

vim.g.lavender = {
  overrides = {
    theme = {
      NormalFoo = { fg = "fg", bg = "purple3", bold = true }, -- add a new highlight group using lavender's colours
      NormalBar = { fg = "Red", bg = "#303030", ctermfg = 196, ctermbg = 236 }, -- using colours directly
      NormalBaz = { fg = "custom_red", ctermfg = "custom_blue" }, -- using colours added in colour overrides below
      -- lavender's colours are lowercase, while nvim's internal colour names are PascalCase

      Normal = { fg = "white", bg = "bg_alt", ctermfg = "white", ctermbg = "bg_alt" }, -- override a highlight group
      -- overriding existing highlight groups will replace the entire definition
    },
    colors = {
      hex = {
        custom_red = "#ff3300", -- add a new colour; this can now be used in any highlight group
      },
      cterm = {
        custom_blue = 33,
      },
    },
  },
}

Palette

#1b1c2b swatch #b4a4f4 swatch
#1b1e2b swatch #b994f1 swatch
#212337 swatch #ad82ed swatch
#403c64 swatch #ecb2f0 swatch
#414863 swatch #f77eae swatch
#515772 swatch #ff5370 swatch
#596399 swatch #ff757f swatch
#7486d6 swatch #f67f81 swatch
#757dac swatch #ff9e7b swatch
#a19bb5 swatch #ffc777 swatch
#a1abe0 swatch #add8e6 swatch
#a3ace1 swatch #80cbc4 swatch
#d6e7f0 swatch #59d6b5 swatch
#e4f3fa swatch #2df4c0 swatch
#eeffff swatch #04d1f9 swatch
#5fafff swatch

License

Copyright 2024 Elias Elwyn a@jthv.ai, GNU LGPL v3.0 only.

This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License, version 3 only, as
published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

Acknowledgements


  1. Taken with swayfx with default blur settings; WALLPAPER AND COMPOSITOR NOT INCLUDED - though you can find this specific wallpaper here (I tweaked the brightness for this screenshot). ↩︎

  2. use :Inspect with your cursor over an element to inspect the syntax tokens - :help :Inspect ↩︎

  3. said plugins, and their config ↩︎

  4. I took advice on config design from @mrcjkb, developer of haskell-tools.nvim. ↩︎

  5. You could probably do it in vimscript if you really wanted to, but I don't know how and certainly couldn't tell you. ↩︎