User guide / Themes

Syntax colours

Development reference · View source

syntax maps highlight scopes to colours:

themes:
  midnight:
    syntax:
      keyword: "#b48ead"
      string: "#a3be8c"
      markup.heading: "#88c0d0"

Code scopes: attribute, comment, constant, constructor, function, keyword, label, namespace, number, operator, property, punctuation, string, tag, type, and variable.

Markdown scopes: markup.heading, markup.bold, markup.italic, markup.link.text, markup.link.url, markup.list, markup.quote, markup.raw, and markup.strikethrough.

Diagnostic scopes: diagnostic.error and diagnostic.warning.

  • An omitted scope uses the theme’s foreground, except diagnostic.error and diagnostic.warning, which use error and warning.
  • An unknown scope name is a configuration error, not silently ignored.
  • Tree-sitter captures use the longest scope that prefixes them, so keyword.control.return takes the keyword colour.
  • Built-in themes colour every Markdown scope.

Some Markdown scopes also carry a text attribute, in rendered pages and in source alike. The attribute belongs to the scope, not the theme; a theme only picks the colour.

ScopeAttribute
markup.bold, markup.headingbold
markup.italicitalic
markup.link.urlunderline
markup.strikethroughcrossed out