Standard Highlighting¶
All RIDDL-aware tools—the IntelliJ plugin, VS Code extension, Synapify editor, ossum.ai playground, and this documentation site—share a common tokenization scheme for syntax highlighting. This page documents the standard token types and their associated colors.
Token Types¶
The RIDDL lexer classifies every span of source text into one of eleven token types, defined in the compiler's AST:
enum Token(at: At):
case Punctuation(at: At)
case QuotedString(at: At)
case Readability(at: At)
case Predefined(at: At)
case Keyword(at: At)
case Comment(at: At)
case LiteralCode(at: At)
case MarkdownLine(at: At)
case Identifier(at: At)
case Numeric(at: At)
case Other(at: At)
Each token type has a specific semantic meaning:
| Token Type | What It Covers | Examples |
|---|---|---|
| Keyword | Definition and statement keywords | domain, context, entity, handler, send, tell |
| Readability | Connecting words that aid readability | is, of, to, with, by, from |
| Predefined | Built-in type names | String, Integer, UUID, Timestamp, Boolean |
| Identifier | User-defined names | MyEntity, OrderPlaced, customerId |
| QuotedString | Double-quoted string literals | "Hello world", "application/json" |
| Numeric | Number literals | 42, 3.14, 100 |
| Punctuation | Structural delimiters and operators | {, }, (, ), ,, :, = |
| Comment | Line and block comments | // comment, /* block */ |
| MarkdownLine | Pipe-prefixed documentation lines | \|## Heading, \|Some description text |
| LiteralCode | Triple-quoted code blocks | ```scala ... ``` |
| Other | Anything not classified above | Placeholder ???, unrecognized text |
Standard Color Scheme¶
The standard RIDDL color scheme uses a dark theme as the primary palette. Each implementation adapts these colors to its platform while preserving the semantic intent.
Dark Theme¶
| Token Type | Color | Hex | Swatch |
|---|---|---|---|
| Keyword | Burnt orange | #fa8b61 |
#fa8b61 |
| Readability | Yellow-olive | #b3ae60 |
#b3ae60 |
| Predefined | Teal | #19c4bf |
#19c4bf |
| Identifier | Light gray | #a9b7c6 |
#a9b7c6 |
| QuotedString | Bright green | #98c379 |
#98c379 |
| Numeric | Steel blue | #6897bb |
#6897bb |
| Punctuation | Teal | #0da19e |
#0da19e |
| Comment | Gray (italic) | #808080 |
#808080 |
| MarkdownLine | Dim green (italic) | #629755 |
#629755 |
| LiteralCode | Dim green | #629755 |
#629755 |
| Other | Light gray | #a9b7c6 |
#a9b7c6 |
Light Theme¶
| Token Type | Color | Hex | Swatch |
|---|---|---|---|
| Keyword | Dark orange | #c75a20 |
#c75a20 |
| Readability | Olive | #7a7a30 |
#7a7a30 |
| Predefined | Teal | #0d8a85 |
#0d8a85 |
| Identifier | Near black | #2b2b2b |
#2b2b2b |
| QuotedString | Forest green | #50873a |
#50873a |
| Numeric | Muted blue | #4a6a9a |
#4a6a9a |
| Punctuation | Teal | #0a7a75 |
#0a7a75 |
| Comment | Gray (italic) | #707070 |
#707070 |
| MarkdownLine | Dark green (italic) | #3d6a30 |
#3d6a30 |
| LiteralCode | Dark green | #3d6a30 |
#3d6a30 |
| Other | Near black | #2b2b2b |
#2b2b2b |
Implementation Notes¶
Platform Variations¶
The standard colors above are the canonical reference. Individual tools may adapt them to fit their platform's conventions:
-
IntelliJ IDEA Plugin — Maps token types to IntelliJ's
TextAttributesKeysystem. Actual colors come from the user's selected theme (e.g., Darcula, IntelliJ Light) so they blend with the rest of the IDE. -
VS Code Extension — Uses TextMate scopes (e.g.,
keyword.control.riddl,support.type.riddl). Colors are determined by the active VS Code color theme. -
Synapify / ossum.ai Playground — These Monaco-based editors use a Catppuccin-inspired palette and split the
Keywordtoken into semantic sub-categories (definition keywords, statement keywords, modifier keywords, etc.) for finer-grained coloring. -
This Documentation Site — Uses a custom Pygments lexer (
riddl_lexer/) with CSS overrides inextra.css. The colors in the tables above are taken directly from this implementation.
Design Principles¶
The color scheme follows these principles:
-
Semantic grouping — Related tokens share color families (e.g., teal for types and punctuation, green for strings and documentation).
-
Keywords stand out — Burnt orange makes structural keywords immediately visible against a dark background.
-
Comments recede — Gray and italic styling keeps comments present but unobtrusive.
-
Light/dark parity — Each dark theme color has a corresponding light theme variant that maintains the same semantic associations at appropriate contrast levels.
Adding RIDDL Highlighting to a New Tool¶
To implement RIDDL syntax highlighting in a new editor or tool:
- Tokenize using the eleven
Tokentypes from the enum above - Map each token type to your platform's highlighting system
- Apply the standard hex colors (or your platform's closest semantic equivalent)
- Test with both light and dark themes
The RIDDL compiler's Lexer produces these tokens directly—see
com.ossuminc.riddl.language.AST.Token in the
riddl repository.