Skip to main content

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’s theme.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
TerminalPane (terminal emulator):
  • 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
TopBar (application titlebar):
  • Background: --tempest-bg-titlebar
  • Text: --tempest-fg-default, --tempest-fg-muted
Dialog/Modal Components (NamingModal, DeleteDialog, etc.):
  • 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
Code Editor Areas (CodeMirrorPane):
  • 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
Checkboxes and Form Controls:
  • Accent color: --tempest-accent-blue
  • Border: --tempest-border-default
Scrollbars:
  • 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 with var():

Data Theme Attribute

The data-theme attribute on the document root element indicates the current theme type:
Possible values are "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:
In the above example, if --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:
  • #ffffff1a represents white with 10% opacity (hex 1a = 26/255 = 10%)
  • #ffffff22 represents white with 13% opacity (hex 22 = 34/255 = 13%)
  • #0000001a represents black with 10% opacity
You can extract and manipulate these values in CSS using color functions:

Performance Considerations

CSS variables are efficiently updated when themes change. The applyTheme() 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.