Skip to content

Theming

Every visual decision in the widget — colors, radii, shadows, fonts — resolves through a --cl-* CSS custom property, so a theme can restyle all of it without forking CSS. Try combinations live in the theme editor.

One option accepts four kinds of values (React prop, window.ClaudiusConfig key, or <claudius-chat theme="..."> attribute):

ValueExampleEffect
Mode string"light", "dark", "auto"Color scheme only (the original API, unchanged)
Built-in theme name"minimal", "playful", "corporate", "default"Applies a bundled theme
Theme object{ colors: { accent: "#0057a3" } }Inline design tokens (React / ClaudiusConfig only)
URL string"https://your-site.example/claudius-theme.json"Fetches a JSON theme file validated against the schema

If a theme URL is unreachable or invalid, the widget logs a console error and keeps the default theme — it never breaks because a theme file is down.

window.ClaudiusConfig = {
apiUrl: "...",
theme: {
colorScheme: "auto",
colors: { accent: "#0057a3", surfaceMuted: "#eef4fa" },
radii: { lg: "12px" },
},
};

A theme file is JSON validated against https://claudius-docs.pages.dev/schema/theme.v1.json (reference it via $schema for IDE autocomplete):

{
"$schema": "https://claudius-docs.pages.dev/schema/theme.v1.json",
"name": "acme",
"colorScheme": "light",
"colors": { "accent": "#aa0000", "userBubbleText": "#fff8f0" },
"colorsDark": { "accent": "#ff6666" },
"radii": { "sm": "4px", "md": "6px", "lg": "10px" },
"shadows": { "elevated": "0 8px 24px rgb(0 0 0 / 0.18)" },
"fonts": { "body": "'Inter', system-ui" }
}

The theme editor builds and exports these files visually.

colors apply to both light and dark mode; colorsDark overrides individual tokens in dark mode only. Untouched tokens use the built-in palette of whichever mode is active.

KeyCSS propertyUsed forLight defaultDark default
accent--cl-color-accentHeader, toggle bubble, send button, focus rings#2563eb#2563eb
accentText--cl-color-accent-textText/icons on accent surfaces#ffffff#ffffff
accentSoft--cl-color-accent-softAvatar circle, hover overlay on the headerrgb(255 255 255 / 0.2)same
accentTextMuted--cl-color-accent-text-mutedDimmed header iconsrgb(255 255 255 / 0.7)same
surface--cl-color-surfaceWindow, panels, greeting card#ffffff#111827
surfaceMuted--cl-color-surface-mutedAssistant bubble, hovers, source cards#f1f5f9#1f2937
text--cl-color-textPrimary text#1e293b#f3f4f6
textMuted--cl-color-text-mutedSecondary text, placeholders#64748b#9ca3af
border--cl-color-borderBorders, dividers, drag handle#e2e8f0#374151
userBubble--cl-color-user-bubbleUser message backgroundfollows accentfollows accent
userBubbleText--cl-color-user-bubble-textUser message text#ffffff#ffffff
assistantBubble--cl-color-assistant-bubbleAssistant message backgroundfollows surfaceMutedfollows surfaceMuted
assistantBubbleText--cl-color-assistant-bubble-textAssistant message text#1e293b#e5e7eb
field--cl-color-fieldInput field background#ffffff#1f2937
error--cl-color-errorError text, retry button#dc2626#f87171
errorSurface--cl-color-error-surfaceError chip background#fef2f2rgb(127 29 29 / 0.3)
errorText--cl-color-error-textText on the retry button#ffffff#ffffff
link--cl-color-linkLinks in messagesinherits text#60a5fa
scrim--cl-color-scrimMobile backdroprgb(0 0 0 / 0.5)same
KeyCSS propertyUsed forDefault
sm--cl-radius-smInput field, send button, error chip8px
md--cl-radius-mdButtons, source cards12px
lg--cl-radius-lgWindow, message bubbles, greeting card16px
full--cl-radius-fullToggle bubble, pills, avatars9999px
tail--cl-radius-tailThe “tail” corner of message bubbles2px
KeyCSS propertyUsed for
elevated--cl-shadow-elevatedChat window
floating--cl-shadow-floatingToggle bubble, greeting card
floatingHover--cl-shadow-floating-hoverGreeting card hover
KeyCSS propertyDefault
heading--cl-font-headingsystem-ui
body--cl-font-bodysystem-ui
NamePersonality
defaultThe stock Claudius look (blue accent, 16px cards)
minimalMonochrome, square-ish corners, hairline shadows
playfulViolet accent, pill-shaped bubbles, soft colored shadows, rounded type
corporateNavy accent, tight radii, subdued grays
window.ClaudiusConfig = { apiUrl: "...", theme: "corporate" };

Built-ins are exported for composing — e.g. corporate in dark mode:

import { ChatWidget, builtinThemes } from "claudius-chat-widget";
<ChatWidget
apiUrl="..."
theme={{ ...builtinThemes.corporate, colorScheme: "dark" }}
/>;

colorScheme inside a theme (or the plain "light" / "dark" / "auto" strings) controls the mode; "auto" follows prefers-color-scheme live. In dark mode every color token swaps to its dark value: your colors, your colorsDark overrides, or the built-in dark palette, in that order.

The v1 accentColor option still works and overrides the theme’s accent — see the migration guide. Pre-token --claudius-* custom properties (e.g. --claudius-primary) also keep working and win over theme tokens; treat them as deprecated.