Basics
&
Match light and dark token palettes for your theme
light.css
:root { --sh-class: #8d85ff; --sh-identifier: #354150; --sh-sign: #8996a3; --sh-string: #00a99a; --sh-keyword: #f47067; --sh-comment: #a19595; --sh-jsxliterals: #bf7db6; --sh-entity: #665ac7; --sh-property: #4e8fdf;}
dark.css
:root[data-theme='dark'] { --sh-class: #7eb5ff; --sh-identifier: #d4d4d4; --sh-sign: #8b949e; --sh-string: #88bbb6; --sh-keyword: #ffada8; --sh-comment: #8b8b8b; --sh-jsxliterals: #d2a8ff; --sh-entity: #b7adff; --sh-property: #79c0ff;}
Line highlighting
Each line is a .sh__line, so target lines with CSS selectors or a custom line class.
Languages
Sugar High includes 29 languages out of the box—no extra grammars or setup required. JavaScript and JSX work by default.
Use lang() to resolve filenames, extensions, and aliases to a language name.
All languages
| Value | Language & relatives |
|---|
javascript | JavaScript, JSX |
|---|
typescript | TypeScript, TSX |
|---|
css | CSS, SCSS |
|---|
python | Python |
|---|
c | C |
|---|
go | Go |
|---|
java | Java |
|---|
rust | Rust |
|---|
json | JSON, JSONC |
|---|
diff | Diff, patch |
|---|
shell | Shell, Bash, Zsh |
|---|
cpp | C++ |
|---|
csharp | C# |
|---|
sql | SQL |
|---|
html | HTML, XML |
|---|
yaml | YAML |
|---|
markdown | Markdown, MDX |
|---|
plaintext | Plain text |
|---|
ruby | Ruby |
|---|
kotlin | Kotlin, Kotlin Script |
|---|
swift | Swift |
|---|
php | PHP |
|---|
toml | TOML |
|---|
powershell | PowerShell |
|---|
dockerfile | Dockerfile |
|---|
graphql | GraphQL |
|---|
hcl | HCL, Terraform |
|---|
zig | Zig |
|---|
lua | Lua |
|---|
Solution
React Components
@sugar-high/react provides <Editor /> & <Code /> to present or edit highlighted code, with built-in themes and custom token colors.