Skip to content

Theme Tokens

Kitsune uses native CSS custom properties. Components consume inherited tokens through shadow DOM; the host chooses their scope. There is no theme singleton or preference service.

import '@atheory-ai/kitsune-ui/theme/tokens.css'

The explicit stylesheet defines defaults in @layer kit.tokens. Importing /theme helpers applies nothing. Neither entry registers components or prepares a host. This page describes the unpublished candidate; use matching archives until its styles and exports are released.

The stylesheet and defaultTheme expose the same sixteen defaults:

TokenDefault
--kit-color-accentlight-dark(oklch(50% 0.16 248), #9ecaff)
--kit-color-accent-contrastlight-dark(white, #102338)
--kit-color-surfaceCanvas
--kit-color-textCanvasText
--kit-color-borderlight-dark(#667085, #98a2b3)
--kit-color-mutedlight-dark(#475467, #c0c8d4)
--kit-color-errorlight-dark(#b42318, #ffb4ab)
--kit-color-successlight-dark(#067647, #75e0a7)
--kit-color-warninglight-dark(#854a0e, #fec84b)
--kit-focus-ringHighlight
--kit-radius-sm0.375rem
--kit-radius-md0.5rem
--kit-space-10.25rem
--kit-space-20.5rem
--kit-space-30.75rem
--kit-space-41rem

The host opts into native preference selection or chooses a scheme explicitly:

:root { color-scheme: light dark; }
.inspection-panel { color-scheme: dark; }
.garden-workspace {
--kit-color-accent: #14532d;
--kit-color-accent-contrast: white;
--kit-space-4: 1.25rem;
}

light-dark() follows the effective color-scheme. The sheet does not set that property. Custom surface/text palettes also need matching semantic colors and contrast checks.

--kit-button-bg, --kit-button-color and --kit-button-border remain optional overrides. Their semantic fallback resolves inside the button:

background: var(--kit-button-bg, var(--kit-color-accent, CanvasText));
color: var(--kit-button-color, var(--kit-color-accent-contrast, Canvas));

Avoid root aliases such as --kit-button-bg: var(--kit-color-accent) if nested scopes should override the accent: CSS resolves that alias where declared before inheritance. The candidate removes these three alias defaults, adds missing semantic/spacing defaults and darkens the light accent after a contrast failure. Upgrade CSS/renderers together; previously applied inline aliases or copied old CSS remain host-owned overrides until removed.

Choose a readable foreground with a button-specific background:

.forest-action {
--kit-button-bg: #14532d;
--kit-button-color: white;
--kit-button-border: #14532d;
}

For a locally owned root without the sheet:

import { applyTheme, defaultTheme, defineTheme, themeToCss } from '@atheory-ai/kitsune-ui/theme'
applyTheme(defaultTheme, ownedRoot)
const brand = defineTheme({
name: 'garden',
tokens: { '--kit-color-accent': '#14532d', '--kit-color-accent-contrast': 'white' },
})
applyTheme(brand, ownedRoot)
// Alternatively generate trusted scoped CSS:
const css = themeToCss(defaultTheme, '.workspace')

defineTheme checks token names in TypeScript, not untrusted CSS safety. applyTheme merges inline properties: omitted keys retain prior values. It is not complete replacement and returns no cleanup handle. The local owner removes/replaces its styles or removes its root. Managed presentation sessions use runtime-owned theme scopes; do not add a second inline writer to those properties.

Changing appearance must preserve native controls, focus/caret, working values, drafts and original pending requests. It sends no commands and acknowledges no outcomes. Renderers inherit styles rather than apply global themes or acquire environments.

Native layout recipes use --kit-space-4 for gap unless --kit-layout-gap overrides it. Supplied fields/cards constrain their boxes; workspace columns adapt to their container. No resize observer or JavaScript layout service is needed.

The supplied card suppresses decorative movement for prefers-reduced-motion. Authored application transitions need their own scoped rule. Native forced-colors adjustment remains enabled; feedback includes words/actions, not color alone.

Storybook’s Patterns / Inherited semantic themes uses existing collection/detail, recoverable form and operation presentation. Chromium checks exercise selected text/control contrast pairs, shadow inheritance, sibling isolation, overrides, keyboard focus, narrow layouts, retained input/unknown-state presentation, reduced motion and forced-color emulation. This is not a complete WCAG, screen-reader or cross-browser audit.