Skip to content

@jsvision/core / createTheme

Function: createTheme()

createTheme(options): Theme

Defined in: color/create-theme.ts:150

Build a complete Theme from seed colors.

Required: a mode and an accent. Everything else is derived — a perceptual neutral ramp yields the surfaces and text, the accent yields the focus/selection colors, and sensible status colors fill the rest. Every produced color is a resolvable Color, so the theme encodes and downsamples like any other.

Parameters

options

ThemeOptions

Seeds (mode, accent, optional neutral/status) plus the overrides (alias-level) and roleOverrides (role-level) hooks.

Returns

Theme

A full theme ready to render or serialize.

Throws

InvalidColorError when a seed is 'default' or otherwise unresolvable.

Example

ts
import { createTheme } from '@jsvision/core';

const dark = createTheme({ mode: 'dark', accent: '#3b82f6' });
const brandRed = createTheme({ mode: 'light', accent: '#3b82f6', overrides: { accent: '#ff0000' } });
brandRed.button.bg; // '#ff0000' — the override re-drove every accent role