Build a Neovim theme from a 16-color terminal palette. Give it the colors from an Alacritty theme and it lays them over a One Dark structure, so your editor matches your terminal.
Ships with a default palette (sienna) and a lualine theme. No dependencies.
With lazy.nvim:
{
"Raphael-Soares/palette16.nvim",
lazy = false,
priority = 1000,
config = function()
require("palette16").setup({})
vim.cmd.colorscheme("palette16")
end,
}Requires Neovim >= 0.9.
Ask the terminal for its colors over OSC escape sequences. Terminal-agnostic, matches whatever palette is actually in use:
require("palette16").setup({ palette = "terminal" })
vim.cmd.colorscheme("palette16")This only works when Neovim can talk to a terminal that answers the query. It
won't work under a GUI, a headless instance, or a multiplexer without passthrough
(tmux needs set -g allow-passthrough on). When it can't read a palette it falls
back to sienna.
Read the palette from your Alacritty config instead. Works without terminal
support (SSH, tmux, GUIs), and follows import so the theme can live in its own
file:
require("palette16").setup({ palette = "alacritty" })
vim.cmd.colorscheme("palette16")Point at a specific file with alacritty_path = "/path/to/alacritty.toml".
To prefer the live terminal but fall back to the config, chain them yourself:
require("palette16").setup({
palette = require("palette16.termcolors").read()
or require("palette16.alacritty").read(),
})Or pass a 16-color terminal palette by hand. The shape mirrors an Alacritty theme, so you can paste the colors straight from one:
require("palette16").setup({
palette = {
primary = { background = "#282828", foreground = "#ebdbb2" },
normal = {
black = "#3c3836", red = "#cc241d", green = "#98971a", yellow = "#d79921",
blue = "#458588", magenta = "#b16286", cyan = "#689d6a", white = "#a89984",
},
bright = {
black = "#928374", red = "#fb4934", green = "#b8bb26", yellow = "#fabd2f",
blue = "#83a598", magenta = "#d3869b", cyan = "#8ec07c", white = "#ebdbb2",
},
},
})This is a terminal palette, not base16. A terminal palette has no dedicated orange
or comment grey, so orange comes from bright.red, comment from bright.black,
and the backgrounds and selections are blended from the background.
require("palette16").setup({
palette = nil, -- a 16-color terminal palette; nil uses sienna
transparent = false, -- transparent editor background (floats stay opaque)
dim_inactive = false, -- darken inactive windows
terminal_colors = true, -- color the built-in :terminal
styles = { -- nvim_set_hl attributes per token class
comments = { italic = true },
},
on_colors = function(colors) end, -- tweak the resolved colors
on_highlights = function(groups, colors) end, -- tweak highlight groups
})lualine: require("lualine").setup({ options = { theme = "palette16" } })
Full option reference, the palette mapping, and the role list are in
:help palette16.
- One Dark (Atom): the color layout every highlight group maps onto.
- onedarkpro.nvim: its treesitter and LSP captures shaped the defaults here.
- base46 (NvChad): a reference for plugin coverage and for keeping transparency and palette handling in one place. palette16 is standalone and shares no code or dependency with it.
MIT