Skip to content

Theming

import { Aside } from ‘@astrojs/starlight/components’;

Built-in slot components (banner, modal, toast, etc.) use a theme system for colors, typography, shapes, and shadows. You can use the default theme, apply a built-in variant, or define your own.

interface RevTurbineTheme {
colors: RevTurbineThemeColors;
typography: RevTurbineThemeTypography;
shape: RevTurbineThemeShape;
shadows: RevTurbineThemeShadows;
}
TokenDefaultPurpose
primary#1e40afPrimary CTA buttons, links
primaryText#ffffffText on primary background
secondary#f3f4f6Secondary buttons, backgrounds
secondaryText#1f2937Text on secondary background
accent#7c3aedHighlight elements
accentText#ffffffText on accent background
background#ffffffPage background
surface#f8fafcCard/surface background
surfaceBorder#e2e8f0Card borders
text#111827Primary text
textSecondary#4b5563Secondary/description text
textMuted#6b7280Muted/hint text
overlayrgba(0,0,0,0.5)Modal backdrop
success#16a34aSuccess states
warning#f59e0bWarning states (quota 70–90%)
danger#dc2626Danger states (quota > 90%)
info#60a5faInformational states
track#e5e7ebMeter/progress track background
toastBackground#1f2937Toast notification background
toastText#ffffffToast notification text
TokenDefaultPurpose
fontFamilysystem-ui, -apple-system, sans-serifBody text
fontFamilyMonoui-monospace, SFMono-Regular, ...Code/CLI text
fontSize14pxBase font size
fontSizeSmall13pxSmall text
fontSizeHeader20pxSection headers
fontSizeLargeHeader28pxPage/modal titles
TokenDefaultPurpose
borderRadiusSmall6pxButtons, inputs
borderRadius8pxCards, panels
borderRadiusLarge12pxModals, large surfaces
TokenDefaultPurpose
medium0 10px 40px rgba(0,0,0,0.25)Toast, dropdown
large0 20px 60px rgba(0,0,0,0.3)Modal

Pass your theme through the ExportedConfig or provider:

const customTheme = {
colors: {
primary: '#6366f1', // Indigo
primaryText: '#ffffff',
accent: '#ec4899', // Pink
accentText: '#ffffff',
surface: '#fafafa',
surfaceBorder: '#e5e5e5',
text: '#171717',
textSecondary: '#525252',
// ... other tokens use defaults
},
typography: {
fontFamily: '"Inter", system-ui, sans-serif',
fontSizeHeader: '18px',
},
shape: {
borderRadius: '12px',
borderRadiusSmall: '8px',
},
shadows: {
large: '0 25px 50px rgba(0,0,0,0.15)',
},
};

Partial themes are merged with defaults — you only need to specify the tokens you want to change.

import { useRevTurbineTheme } from '@revturbine/sdk';
function ThemedBadge({ label }) {
const theme = useRevTurbineTheme();
return (
<span style={{
background: theme.colors.accent,
color: theme.colors.accentText,
borderRadius: theme.shape.borderRadiusSmall,
fontFamily: theme.typography.fontFamily,
fontSize: theme.typography.fontSizeSmall,
padding: '2px 8px',
}}>
{label}
</span>
);
}

Custom slot components receive the theme as a prop:

function MySlot({ content, theme }: PlacementSlotProps) {
return (
<div style={{
background: theme.colors.surface,
color: theme.colors.text,
borderRadius: theme.shape.borderRadius,
}}>
{content?.body}
</div>
);
}

The theme is resolved from multiple sources, in priority order:

  1. ExportedConfig snapshot — theme bundled in the config (no network call)
  2. API / localStorage — fetched from the RevTurbine API or cached
  3. Default theme — built-in defaults

In local_only mode, the theme always comes from the ExportedConfig.