Skip to main content

Themes

Codebolt has a built-in theme system that lets you create, manage, and switch visual themes. Themes are database-backed, managed via a REST API, and applied at runtime through CSS variables.

How It Works

  1. Themes are stored in a JSON database with 100+ color properties.
  2. The ThemeProvider reads the active theme and injects CSS variables (--theme-*) on the document root.
  3. All UI components use these CSS variables for colors, making theme switches instant.
  4. Themes are managed via REST API — create, update, delete, set active.

Color Groups

Each theme defines colors across these groups:

GroupExamples
Basebackground, foreground
UI Controlsbutton, dropdown, input, badge, progress bar
Sidebar & Activity Barbackground, foreground, borders
Editorbackground, foreground, selection, line numbers, cursor, gutters
Panel & Status Barbackground, foreground, borders, titles
TerminalANSI colors (16 standard + bright variants)
Chatuser bubbles, agent bubbles, code blocks, commands
Lists & Treesselection, hover states

CSS Variables

The ThemeProvider injects variables in the format --theme-<property>:

--theme-background
--theme-foreground
--theme-primary
--theme-secondary
--theme-accent
--theme-border
--theme-editor-background
--theme-editor-foreground
--theme-terminal-ansiRed
--theme-sidebar-background
--theme-statusBar-background
/* ... 100+ more */

Components reference these variables:

.my-component {
background: var(--theme-background);
color: var(--theme-foreground);
border: 1px solid var(--theme-border);
}

Theme API

Manage themes via REST endpoints:

MethodEndpointDescription
GET/themes/List all themes
GET/themes/:idGet a specific theme
POST/themes/Create a new theme
PUT/themes/:idUpdate a theme
DELETE/themes/:idDelete a theme
POST/themes/set-activeSet the active theme
GET/themes/activeGet the current active theme
POST/themes/resetReset to default themes
GET/themes/statsGet theme statistics

Creating a theme via API

curl -X POST http://localhost:2719/themes/ \
-H "Content-Type: application/json" \
-d '{
"name": "My Custom Theme",
"type": "dark",
"colors": {
"background": "#0f1117",
"foreground": "#e2e4f0",
"primary": "#5b6af0",
"secondary": "#1a1d27",
"accent": "#5b6af0",
"border": "#2a2d3e",
"editor-background": "#0f1117",
"editor-foreground": "#e2e4f0",
"sidebar-background": "#1a1d27",
"statusBar-background": "#0f1117"
}
}'

Setting the active theme

curl -X POST http://localhost:2719/themes/set-active \
-H "Content-Type: application/json" \
-d '{ "themeId": "my-custom-theme-id" }'

Client SDK

The Client SDK provides a ThemesApi for programmatic theme management:

// List all themes
const themes = await codebolt.themes.getAll();

// Get active theme
const active = await codebolt.themes.getActive();

// Create a theme
await codebolt.themes.create({ name: 'My Theme', type: 'dark', colors: { ... } });

// Set active theme
await codebolt.themes.setActive({ themeId: 'my-theme-id' });

Built-in Themes

Codebolt ships with several pre-seeded themes covering light and dark variants. Use POST /themes/seed-popular to re-seed popular community themes.

See Also