This page lists CSS variables for code.

CSS variables

VariableDescription
--code-backgroundCode background color
--code-white-spaceCode white-space
--code-sizeCode font size

Syntax highlighting

Note

Since Obsidian uses two different libraries for syntax highlighting—one for Editing view and another for Reading view—styling may not match perfectly between the two.

VariableDescription
--code-normalNon-highlighted syntax
--code-commentComments
--code-functionFunctions
--code-importantImportant, regex
--code-keywordKeywords
--code-operatorOperators
--code-propertyProperties
--code-punctuationPunctuation
--code-stringStrings
--code-tagTags, symbols, constants
--code-valueValues