You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helix/book/src/configuration.md

4.4 KiB

Configuration

Theme

Use a custom theme by placing a theme.toml in your config directory (i.e ~/.config/helix/theme.toml). The default theme.toml can be found here, and user submitted themes here.

Styles in theme.toml are specified of in the form:

key = { fg = "#ffffff", bg = "#000000", modifiers = ["bold", "italic"] }

where name represents what you want to style, fg specifies the foreground color, bg the background color, and modifiers is a list of style modifiers. bg and modifiers can be omitted to defer to the defaults.

To specify only the foreground color:

key = "#ffffff"

if the key contains a dot '.', it must be quoted to prevent it being parsed as a dotted key.

"key.key" = "#ffffff"

Possible modifiers:

Modifier
bold
dim
italic
underlined
slow\_blink
rapid\_blink
reversed
hidden
crossed\_out

Possible keys:

Key Notes
attribute
keyword
keyword.directive Preprocessor directives (#if in C)
namespace
punctuation
punctuation.delimiter
operator
special
property
variable
variable.parameter
type
type.builtin
constructor
function
function.macro
function.builtin
comment
variable.builtin
constant
constant.builtin
string
number
escape Escaped characters
label For lifetimes
module
ui.background
ui.linenr
ui.linenr.selected For lines with cursors
ui.statusline
ui.popup
ui.window
ui.help
ui.text
ui.text.focus
ui.menu.selected
ui.selection For selections in the editing area
warning LSP warning
error LSP error
info LSP info
hint LSP hint

These keys match tree-sitter scopes. We half-follow the common scopes from macromates language grammars with some differences.

For a given highlight produced, styling will be determined based on the longest matching theme key. So it's enough to provide function to highlight function.macro and function.builtin as well, but you can use more specific scopes to highlight specific cases differently.