Tempest CSS Variables Reference
Tempest’s theme system is built on CSS custom properties (variables) that change based on the active theme. Every token in a theme’stheme.json file is automatically converted to a --tempest-* CSS variable.
Token to CSS Variable Conversion
The conversion rule is simple: replace dots with dashes and prepend--tempest-.
Background Variables
Background colors are used for surfaces at different layers of the application.Foreground (Text) Variables
Foreground colors are used for text and icons at different emphasis levels.Border Variables
Border colors provide visual separation at different prominence levels.Accent Colors
Accent colors are used for highlights, active states, and semantic meaning. Available in seven hues.Syntax Highlighting Variables
Used in code editors and code display areas for syntax-aware coloring.Git Status Colors
Used to indicate the status of files in version control contexts.Island Component Variables
Island components are collapsed/expandable UI containers used for collapsible panels.Tooltip Variables
Used for tooltip overlays and popover elements.Semantic Intent Colors
Semantic colors convey intent or message type across the UI.Terminal and ANSI Colors
Terminal emulators use these variables for the 16 standard ANSI colors plus foreground/selection.Component Usage Guide
This section lists which CSS variables are used by specific components throughout Tempest.Core Layout Components
WorkspaceView (sidebar, tabs, panes):- Background variables:
--tempest-bg-base,--tempest-bg-sidebar,--tempest-bg-panel,--tempest-bg-editor - Text variables:
--tempest-fg-default,--tempest-fg-muted,--tempest-fg-subtle - Border variables:
--tempest-border-default,--tempest-border-subtle - Accent variables:
--tempest-accent-blue,--tempest-accent-green,--tempest-accent-yellow,--tempest-accent-red - Git status:
--tempest-git-added,--tempest-git-modified,--tempest-git-deleted
- Background:
--tempest-bg-elevated,--tempest-bg-input - Text:
--tempest-text-primary,--tempest-text-muted(note: these may be aliases for fg variables) - Border:
--tempest-border-subtle - Terminal colors: All
--tempest-terminal-*variables - Accent:
--tempest-accent-blue
- Background:
--tempest-bg-titlebar - Text:
--tempest-fg-default,--tempest-fg-muted
- Background:
--tempest-bg-sidebar,--tempest-bg-editor - Text:
--tempest-fg-default,--tempest-fg-subtle,--tempest-fg-muted - Border:
--tempest-border-default - Accent:
--tempest-accent-blue,--tempest-accent-red
- Background:
--tempest-bg-editor - Syntax: All
--tempest-syntax-*variables - Accent:
--tempest-accent-*variables (for highlights, selections, errors)
Interactive Elements
Buttons and Links:- Default:
--tempest-fg-default,--tempest-border-default,--tempest-bg-hover - Hover:
--tempest-bg-active - Accents:
--tempest-accent-*colors based on button type
- Accent color:
--tempest-accent-blue - Border:
--tempest-border-default
- Thumb (the draggable part):
--tempest-border-subtle - Track (background): Transparent
- Hover:
--tempest-accent-blue
Complete Theme JSON Structure
Here is the complete structure of a Tempest theme file (theme.json):Using CSS Variables in Custom Styles
To use Tempest’s CSS variables in your own stylesheets, simply reference them withvar():
Data Theme Attribute
Thedata-theme attribute on the document root element indicates the current theme type:
"dark" or "light". You can use this in CSS selectors if needed for theme-specific overrides:
Fallback Values
CSS variables support fallback values, which is useful for components that might reference a variable that doesn’t exist in all theme versions:--tempest-bg-elevated is not defined, it falls back to --tempest-bg-panel. This pattern is used throughout Tempest to ensure graceful degradation across theme versions.
Transparency and Alpha Channels
Many theme variables use alpha transparency for hover and selection states. For example:#ffffff1arepresents white with 10% opacity (hex1a= 26/255 = 10%)#ffffff22represents white with 13% opacity (hex22= 34/255 = 13%)#0000001arepresents black with 10% opacity
Performance Considerations
CSS variables are efficiently updated when themes change. TheapplyTheme() function in Tempest sets all theme variables at once on the document root, making theme switching instant across the entire application.
All variables are inherited, so child elements automatically receive the updated values without requiring DOM re-renders or explicit updates.