Skip to content

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

Fušla: toStyledTheme()

toStyledTheme(tokens, options?): StyledTheme

Eksperimentála

Geavahit CSS-in-JS tema-objekt token IR-sta.

Parametera

tokens

ruvvojuvvon Token[]

IR (go @pantoken/tokens.)

options?

ToStyledThemeOptions = {}

ToStyledThemeOptions.

Gullii / Gávdnat

StyledTheme

Tema-objekta, gitta camelCased token-namme.

Exempla

var()-backed, light/dark guođđit @pantoken/css-is

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

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

Bakka konkretat single-mode értot (SSR:sii ilman CSS-muhtunččaid)

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()