Themes

To use a theme add theme = "<name>" to the top of your config.toml file, or select it during runtime using :theme <name>.

Creating a theme

Create a file with the name of your theme as the file name (i.e mytheme.toml) and place it in your themes directory (i.e ~/.config/helix/themes or %AppData%\helix\themes on Windows). The directory might have to be created beforehand.

💡 The names "default" and "base16_default" are reserved for built-in themes and cannot be overridden by user-defined themes.

Overview

Each line in the theme file is specified as below:

key = { fg = "#ffffff", bg = "#000000", underline = { color = "#ff0000", style = "curl"}, modifiers = ["bold", "italic"] }

Where key represents what you want to style, fg specifies the foreground color, bg the background color, underline the underline style/color, and modifiers is a list of style modifiers. bg, underline 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"

For inspiration, you can find the default theme.toml here and user-submitted themes here.

Using the linter

Use the supplied linting tool to check for errors and missing scopes:

cargo xtask themelint onedark # replace onedark with <name>

The details of theme creation

Color palettes

It's recommended to define a palette of named colors, and refer to them in the configuration values in your theme. To do this, add a table called palette to your theme file:

"ui.background" = "white"
"ui.text" = "black"

[palette]
white = "#ffffff"
black = "#000000"

Keep in mind that the [palette] table includes all keys after its header, so it should be defined after the normal theme options.

The default palette uses the terminal's default 16 colors, and the colors names are listed below. The [palette] section in the config file takes precedence over it and is merged into the default palette.

Color Name
black
red
green
yellow
blue
magenta
cyan
gray
light-red
light-green
light-yellow
light-blue
light-magenta
light-cyan
light-gray
white

Modifiers

The following values may be used as modifier, provided they are supported by your terminal emulator.

Modifier
bold
dim
italic
underlined
slow_blink
rapid_blink
reversed
hidden
crossed_out

💡 The underlined modifier is deprecated and only available for backwards compatibility. Its behavior is equivalent to setting underline.style="line".

Underline style

One of the following values may be used as a value for underline.style, providing it is supported by your terminal emulator.

Modifier
line
curl
dashed
dotted
double_line

Inheritance

Extend other themes by setting the inherits property to an existing theme.

inherits = "boo_berry"

# Override the theming for "keyword"s:
"keyword" = { fg = "gold" }

# Override colors in the palette:
[palette]
berry = "#2A2A4D"

Scopes

The following is a list of scopes available to use for styling:

Syntax highlighting

These keys match tree-sitter scopes.

When determining styling for a highlight, the longest matching theme key will be used. For example, if the highlight is function.builtin.static, the key function.builtin will be used instead of function.

We use a similar set of scopes as Sublime Text. See also TextMate scopes.

  • attribute - Class attributes, HTML tag attributes

  • type - Types

    • builtin - Primitive types provided by the language (int, usize)
    • enum
      • variant
  • constructor

  • constant (TODO: constant.other.placeholder for %v)

    • builtin Special constants provided by the language (true, false, nil etc)
      • boolean
    • character
      • escape
    • numeric (numbers)
      • integer
      • float
  • string (TODO: string.quoted.{single, double}, string.raw/.unquoted)?

    • regexp - Regular expressions
    • special
      • path
      • url
      • symbol - Erlang/Elixir atoms, Ruby symbols, Clojure keywords
  • comment - Code comments

    • line - Single line comments (//)
    • block - Block comments (e.g. (/* */)
      • documentation - Documentation comments (e.g. /// in Rust)
  • variable - Variables

    • builtin - Reserved language variables (self, this, super, etc.)
    • parameter - Function parameters
    • other
      • member - Fields of composite data types (e.g. structs, unions)
  • label

  • punctuation

    • delimiter - Commas, colons
    • bracket - Parentheses, angle brackets, etc.
    • special - String interpolation brackets.
  • keyword

    • control
      • conditional - if, else
      • repeat - for, while, loop
      • import - import, export
      • return
      • exception
    • operator - or, in
    • directive - Preprocessor directives (#if in C)
    • function - fn, func
    • storage - Keywords describing how things are stored
      • type - The type of something, class, function, var, let, etc.
      • modifier - Storage modifiers like static, mut, const, ref, etc.
  • operator - ||, +=, >

  • function

    • builtin
    • method
    • macro
    • special (preprocessor in C)
  • tag - Tags (e.g. <body> in HTML)

    • builtin
  • namespace

  • special

  • markup

    • heading
      • marker
      • 1, 2, 3, 4, 5, 6 - heading text for h1 through h6
    • list
      • unnumbered
      • numbered
      • checked
      • unchecked
    • bold
    • italic
    • strikethrough
    • link
      • url - URLs pointed to by links
      • label - non-URL link references
      • text - URL and image descriptions in links
    • quote
    • raw
      • inline
      • block
  • diff - version control changes

    • plus - additions
    • minus - deletions
    • delta - modifications
      • moved - renamed or moved files/changes

Interface

These scopes are used for theming the editor interface:

  • markup
    • normal
      • completion - for completion doc popup UI
      • hover - for hover popup UI
    • heading
      • completion - for completion doc popup UI
      • hover - for hover popup UI
    • raw
      • inline
        • completion - for completion doc popup UI
        • hover - for hover popup UI
KeyNotes
ui.background
ui.background.separatorPicker separator below input line
ui.cursor
ui.cursor.normal
ui.cursor.insert
ui.cursor.select
ui.cursor.matchMatching bracket etc.
ui.cursor.primaryCursor with primary selection
ui.cursor.primary.normal
ui.cursor.primary.insert
ui.cursor.primary.select
ui.debug.breakpointBreakpoint indicator, found in the gutter
ui.debug.activeIndicator for the line at which debugging execution is paused at, found in the gutter
ui.gutterGutter
ui.gutter.selectedGutter for the line the cursor is on
ui.highlight.framelineLine at which debugging execution is paused at
ui.linenrLine numbers
ui.linenr.selectedLine number for the line the cursor is on
ui.statuslineStatusline
ui.statusline.inactiveStatusline (unfocused document)
ui.statusline.normalStatusline mode during normal mode (only if editor.color-modes is enabled)
ui.statusline.insertStatusline mode during insert mode (only if editor.color-modes is enabled)
ui.statusline.selectStatusline mode during select mode (only if editor.color-modes is enabled)
ui.statusline.separatorSeparator character in statusline
ui.popupDocumentation popups (e.g. Space + k)
ui.popup.infoPrompt for multiple key options
ui.windowBorderlines separating splits
ui.helpDescription box for commands
ui.textCommand prompts, popup text, etc.
ui.text.focus
ui.text.inactiveSame as ui.text but when the text is inactive (e.g. suggestions)
ui.text.infoThe key: command text in ui.popup.info boxes
ui.virtual.rulerRuler columns (see the editor.rulers config)
ui.virtual.whitespaceVisible whitespace characters
ui.virtual.indent-guideVertical indent width guides
ui.virtual.inlay-hintDefault style for inlay hints of all kinds
ui.virtual.inlay-hint.parameterStyle for inlay hints of kind parameter (LSPs are not required to set a kind)
ui.virtual.inlay-hint.typeStyle for inlay hints of kind type (LSPs are not required to set a kind)
ui.virtual.wrapSoft-wrap indicator (see the editor.soft-wrap config)
ui.menuCode and command completion menus
ui.menu.selectedSelected autocomplete item
ui.menu.scrollfg sets thumb color, bg sets track color of scrollbar
ui.selectionFor selections in the editing area
ui.selection.primary
ui.highlightHighlighted lines in the picker preview
ui.cursorline.primaryThe line of the primary cursor (if cursorline is enabled)
ui.cursorline.secondaryThe lines of any other cursors (if cursorline is enabled)
ui.cursorcolumn.primaryThe column of the primary cursor (if cursorcolumn is enabled)
ui.cursorcolumn.secondaryThe columns of any other cursors (if cursorcolumn is enabled)
warningDiagnostics warning (gutter)
errorDiagnostics error (gutter)
infoDiagnostics info (gutter)
hintDiagnostics hint (gutter)
diagnosticDiagnostics fallback style (editing area)
diagnostic.hintDiagnostics hint (editing area)
diagnostic.infoDiagnostics info (editing area)
diagnostic.warningDiagnostics warning (editing area)
diagnostic.errorDiagnostics error (editing area)