Skip to main content

Color Tokens

Scaffald UI uses semantic color tokens that automatically adapt to light and dark themes.

Token Structure​

colors.{semantic}.{theme}.{variant}

Semantic Categories​

Background Colors (colors.bg)​

TokenLightDarkUsage
colors.bg[theme].default#ffffff#1a1a2eMain backgrounds
colors.bg[theme].subtle#f9fafb#1f2937Subtle backgrounds
colors.bg[theme].muted#f3f4f6#374151Muted backgrounds
colors.bg[theme].primary#2563eb#3b82f6Primary brand
colors.bg[theme].secondary#7c3aed#8b5cf6Secondary brand
colors.bg[theme].success#16a34a#22c55eSuccess states
colors.bg[theme].warning#d97706#f59e0bWarning states
colors.bg[theme].error#dc2626#ef4444Error states

Text Colors (colors.text)​

TokenUsage
colors.text[theme].primaryPrimary text content
colors.text[theme].secondarySecondary/supporting text
colors.text[theme].mutedMuted/disabled text
colors.text[theme].inverseText on colored backgrounds

Border Colors (colors.border)​

TokenUsage
colors.border[theme].defaultDefault borders
colors.border[theme].subtleSubtle borders
colors.border[theme].primaryPrimary accent borders

Foreground Colors (colors.fg)​

TokenUsage
colors.fg[theme].defaultDefault foreground elements
colors.fg[theme].mutedMuted foreground elements
colors.fg[theme].primaryPrimary foreground

Icon Colors (colors.icon)​

TokenUsage
colors.icon[theme].defaultDefault icon color
colors.icon[theme].mutedMuted/inactive icons
colors.icon[theme].primaryPrimary accent icons

Usage​

import { colors, useThemeContext } from '@scaffald/ui';

function MyComponent() {
const { theme } = useThemeContext();

return (
<View style={{
backgroundColor: colors.bg[theme].default,
borderColor: colors.border[theme].default,
}}>
<Text style={{ color: colors.text[theme].primary }}>
Themed Content
</Text>
</View>
);
}

Common Mistakes​

Wrong:

colors.background[theme].default  // 'background' doesn't exist
colors.text.primary // Missing theme

Correct:

colors.bg[theme].default          // Use 'bg' not 'background'
colors.text[theme].primary // Include theme

See Also​