Type alias Theme

Theme: Record<string, Styles> | Map<string, Styles>

Theme objects can be either a Map or object where the keys are the selectors and the values are either a styling function or an array of styling functions to be applied in order.

The _ style rule applies to the block as a whole, and is used as the default style. This is where you'd usually port a PrismJS theme's code[class*="language-"] css rule.

The lineNumber style rule will apply to line numbers, if they are used.

The semantics are similar to CSS, where a nested property will be applied to nodes within that nesting stack with a higher priority the more tags that match, and later rules taking precedence over earlier ones. It's not a full CSS selector syntax though, so things like .token.italic.bold aren't supported. Just individual token class names, possibly nested. Also, chalk is not CSS, and a terminal is not a browser, so there are some differences and limitations of course.

Aliases are also not supported, styles have to be applied to the actual parsed class names PrismJS provides.

Generated using TypeDoc