True Color and Highlight Groups
True Color and Highlight Groups
Turn on true color first
Terminals historically offered 256 colors. Modern terminals support 24-bit color, but Neovim only uses it when you ask:
set termguicolorsWith this set, highlight definitions use guifg/guibg hex values like
#00ff00 instead of approximated terminal palette indexes. Every theme in
this guide assumes it is on.
Everything is a highlight group
Every piece of text Neovim draws — keywords, strings, comments, the status line, even the line numbers — belongs to a highlight group. A colorscheme is nothing more than a list of rules assigning colors to those groups.
Inspect what is under your cursor:
:InspectRestyle a group live with :hi:
:hi Comment guifg=#D1D1D1 gui=italic
:hi String guifg=#FFF066The change applies instantly — which makes building a theme a tight feedback loop: look at code, tweak a group, look again.
The groups that matter most
You can get a complete-feeling theme from a dozen groups:
| Group | What it paints |
|---|---|
Normal | plain text and default background |
Comment | comments |
String | string literals |
Function | function names |
Keyword | if, for, def, local, … |
Operator | =, +, ->, … |
Number | numeric literals |
Boolean | true / false |
Start with these, then extend to UI groups (CursorLine, StatusLine,
Visual) as taste demands.