Skip to content

pantoken / renderers/css-in-js/src / toStyledTheme

Functie: toStyledTheme()

toStyledTheme(tokens, options?): StyledTheme

Experimenteel

Bouw een CSS-in-JS thema-object vanuit een token-IR.

Parameters

tokens

alleen-lezen Token[]

De IR (bijvoorbeeld van @pantoken/tokens).

options?

ToStyledThemeOptions = {}

ToStyledThemeOptions.

Retourneert

StyledTheme

Het thema-object, met sleutels op basis van de camelCased tokennaam.

Voorbeelden

var()-gebaseerd, light/dark-stromen via @pantoken/css

ts
import { toStyledTheme } from "@pantoken/css-in-js";
import { tokens } from "@pantoken/tokens";

const theme = toStyledTheme(tokens);
// theme.colorBackgroundBrand → "var(--instui-color-background-brand)"

Inbakken van concrete single-mode-waarden (voor SSR zonder CSS-variabelen)

ts
import { toStyledTheme } from "@pantoken/css-in-js";
import { tokens } from "@pantoken/tokens";

const dark = toStyledTheme(tokens, { resolve: "dark" });
// dark.colorBackgroundBase → a concrete value, not a var()