CSS Variables
Code Syntactic Sugar uses CSS variables to style different token types. All class names use the--css- prefix. You can customize the appearance by adding CSS to your global stylesheet.
Default Theme Variables
Here’s the complete list of CSS variables you can customize:Variable Mapping
Token type to CSS variable mapping
Token type to CSS variable mapping
Each token type corresponds to a specific CSS variable:
| Token Type | CSS Variable | Default Color |
|---|---|---|
| identifier | --css-identifier | #354150 |
| keyword | --css-keyword | #f47067 |
| string | --css-string | #00a99a |
| class | --css-class | #2d5e9d |
| property | --css-property | #0550ae |
| entity | --css-entity | #249a97 |
| jsxliterals | --css-jsxliterals | #6266d1 |
| sign | --css-sign | #8996a3 |
| comment | --css-comment | #a19595 |
Token Class Names
Each token is wrapped in a<span> element with a specific class name following the pattern .css__token--<token-type>.
Styling Individual Token Types
You can target specific token types using CSS classes:Line Styling
Each line of code is wrapped in a<span> element with the .css__line class:
Dark Mode Support
Create a dark theme by overriding CSS variables for dark mode:- CSS Media Query
- Dark Class
Container Styling
Style the<pre> and <code> elements that contain your highlighted code:
Example: Custom Theme
Here’s a complete example of a custom “Ocean” theme:See the Custom Themes guide for more theme examples and best practices.