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.
Defaults
Section titled “Defaults”The stylesheet and defaultTheme expose the same sixteen defaults:
| Token | Default |
|---|---|
--kit-color-accent | light-dark(oklch(50% 0.16 248), #9ecaff) |
--kit-color-accent-contrast | light-dark(white, #102338) |
--kit-color-surface | Canvas |
--kit-color-text | CanvasText |
--kit-color-border | light-dark(#667085, #98a2b3) |
--kit-color-muted | light-dark(#475467, #c0c8d4) |
--kit-color-error | light-dark(#b42318, #ffb4ab) |
--kit-color-success | light-dark(#067647, #75e0a7) |
--kit-color-warning | light-dark(#854a0e, #fec84b) |
--kit-focus-ring | Highlight |
--kit-radius-sm | 0.375rem |
--kit-radius-md | 0.5rem |
--kit-space-1 | 0.25rem |
--kit-space-2 | 0.5rem |
--kit-space-3 | 0.75rem |
--kit-space-4 | 1rem |
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.
Button overrides and inheritance
Section titled “Button overrides and inheritance”--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;}Local and managed ownership
Section titled “Local and managed ownership”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.
Presentation and qualification
Section titled “Presentation and qualification”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.