- Light mode
- Random Accent Color
- Custom Accent Color
- Works with and without
termguicolors(gui + 256-color cterm values) - Treesitter, LSP semantic tokens and diagnostics
- Plugin support (see below) and a lualine theme
- Colors from your terminal theme (
terminal_palette) - Color harmonies: derive matching colors from one accent
- Readable text guaranteed (WCAG contrast check), also on light backgrounds
- Nix flake with a nixvim module
-
:Accentcommand to change colors live
Tested on Neovim 0.12 (vim.pack needs 0.12+). Each example uses an orange accent;
see Configuration for every option.
vim.pack (built into Neovim 0.12+)
vim.pack.add { 'https://github.com/svin24/accent.nvim' }
require('accent').setup { accent_color = 'orange' }
vim.cmd.colorscheme 'accent'Update with :lua vim.pack.update().
lazy.nvim
return {
'svin24/accent.nvim',
lazy = false,
priority = 1000, -- load before other plugins so they pick up its colors
config = function()
require('accent').setup { accent_color = 'orange' }
vim.cmd.colorscheme 'accent'
end,
}mini.deps
MiniDeps.add { source = 'svin24/accent.nvim' }
require('accent').setup { accent_color = 'orange' }
vim.cmd.colorscheme 'accent'vim-plug
call plug#begin()
Plug 'svin24/accent.nvim'
call plug#end()
lua require('accent').setup { accent_color = 'orange' }
colorscheme accentNix (nixvim or home-manager)
The repo is a flake. Add it as an input:
# flake.nix
inputs.accent-nvim = {
url = "github:svin24/accent.nvim";
inputs.nixpkgs.follows = "nixpkgs";
};nixvim, with the bundled module:
{ inputs, ... }:
{
imports = [ inputs.accent-nvim.nixvimModules.default ];
colorschemes.accent = {
enable = true;
settings = {
accent_color = "orange";
};
};
}home-manager's programs.neovim, with the overlay (nixpkgs.overlays = [ inputs.accent-nvim.overlays.default ];):
programs.neovim = {
plugins = [ pkgs.vimPlugins.accent-nvim ];
extraLuaConfig = ''
require('accent').setup { accent_color = 'orange' }
vim.cmd.colorscheme 'accent'
'';
};The package alone is inputs.accent-nvim.packages.${system}.default.
All options with their defaults:
require('accent').setup {
-- 'red', 'orange', 'yellow', 'green', 'blue', 'magenta' or 'cyan'.
-- Leave it out for a random accent.
accent_color = nil,
-- your own accent: a hex string (the other shades are derived), or
-- { fg = '#ff0000', bg = '#aa0000', ctermfg = 196, ctermbg = 124 }
custom_accent = nil,
-- pick the accent from a hash of the current directory
auto_cwd_color = false,
-- use the terminal's own ANSI colors, see below
terminal_palette = false,
-- derive extra accents with a color-wheel harmony, see below
harmony = nil,
-- 0..1, lean the grays towards the accent hue
tint = 0,
-- minimum WCAG contrast of colored text against the background (false to disable)
min_contrast = 4.5,
-- makes the background and some text colours darker
darken = false,
-- inverts the colour of the status line text
invert_status = false,
-- don't set a background colour, use the terminal's
no_bg = false,
-- set vim.g.terminal_color_0..15 for :terminal buffers
terminal_colors = true,
-- every integration is on by default, disable the ones you don't want,
-- e.g. { telescope = false }
integrations = {},
-- your own highlights, applied last. A table, or a function:
-- overrides = function(p, config) return { Comment = { fg = p.fg_dim, italic = true } } end
overrides = {},
}Light mode follows vim.o.background; set it before loading the colorscheme.
The priority for colors is the following:
Custom Accent -> Accent Color -> Directory based Color -> Terminal Color -> Random Color
Changes only what you name and keeps the rest of your config, for the current
session. :Accent alone shows the current settings, <Tab> completes.
:Accent red " a built-in accent
:Accent #1ecbe1 " any hex color
:Accent random " roll a new one
:Accent terminal " (re)read the terminal theme's colors
:Accent harmony triadic " or: harmony off
:Accent tint 0.5
:Accent toggle bg " transparent background on/off (also: darken, status):set background=light / dark switches modes. From Lua, the same is
require('accent').set { harmony = 'triadic' }.
require('accent').setup { terminal_palette = true, no_bg = true }terminal_palette asks the terminal for its ANSI colors at startup (OSC 4,
the same way Neovim detects background) and uses its red, green, yellow,
blue, magenta and cyan everywhere: accent, diagnostics, git signs. Without an
accent_color the accent is the most saturated of them; accent_color = 'cyan'
picks the terminal's cyan. Combined with no_bg the editor blends into the
terminal theme. GUIs such as Neovide, and terminals that don't answer, get the
built-in colors.
Give accent.nvim a single color and it can work out colors that pair with it:
require('accent').setup {
custom_accent = '#1ecbe1', -- a hex string is enough, the darker shade and cterm values are derived
harmony = 'triadic', -- complementary, split, analogous, triadic, tetradic, square, monochromatic
tint = 0.5, -- 0..1, lean the grays towards the accent hue
min_contrast = 4.5, -- WCAG ratio colored text must reach (false to disable)
}Harmonies are hue rotations done in OKLCH, a perceptually uniform color space, so the derived colors look as bright and as saturated as your accent. Strings keep the accent; with a harmony, functions get the second color and numbers/booleans the third. Diagnostic and git colors are never rotated, so red still means error.
min_contrast (on by default) only adjusts lightness, and keeps text readable
on light backgrounds too.
Highlight specs in overrides take palette colors (p.accent, p.accent_bg,
p.fg, p.fg_bright, p.fg_dim, p.fg_dimmer, p.fg_inv, p.bg, p.bg_alt,
p.bg_alt2, p.red, p.green, p.yellow, p.blue, p.magenta, p.cyan,
p.orange and *_bg variants), which set both the gui and cterm color, or
plain '#rrggbb' strings.
For plugins that take colors directly (bufferline, heirline, ...) use
require('accent').palette(); each color is a { '#hex', cterm } pair.
| Integration key | Plugins |
|---|---|
blink |
blink.cmp |
cmp |
nvim-cmp |
dap |
nvim-dap, nvim-dap-ui |
dashboard |
dashboard-nvim, alpha-nvim |
editing |
indent-blankline, vim-illuminate, flash, leap, rainbow-delimiters, todo-comments, nvim-navic, trouble |
explorers |
neo-tree, nvim-tree, oil |
fzf |
fzf-lua |
git |
neogit, diffview |
gitsigns |
gitsigns |
lazy |
lazy.nvim |
markdown |
render-markdown |
mason |
mason |
mini |
mini.nvim (statusline, tabline, pick, files, clue, notify, starter, diff, hipatterns, ...) |
notify |
nvim-notify, noice, fidget |
snacks |
snacks.nvim |
telescope |
telescope |
which_key |
which-key |
Lualine: require('lualine').setup { options = { theme = 'accent' } }
Anything else that links to the standard groups (NormalFloat, FloatBorder,
Pmenu*, Diagnostic*, Added/Changed/Removed, treesitter @ groups)
picks up the theme automatically. PRs adding a file to
lua/accent/integrations/ are welcome.
Alligator for the original accent.vim: https://github.com/Alligator/accent.vim
