Skip to content

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

Feidhm: toStyledTheme()

toStyledTheme(tokens, options?): StyledTheme

Turgnamhach

Tóg réad téama CSS-in-JS ón token IR.

Paraiméadair

tokens

neamh-inathraitheach Token[]

An IR (m.sh. ó @pantoken/tokens).

options?

ToStyledThemeOptions = {}

ToStyledThemeOptions.

Tuairisceáin

StyledTheme

An réad téama, eochairithe de réir ainm token i camelCase.

Samplaí

tacaíocht var()-, sruthanna éadrom/dorcha tríd @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)"

Cuir luachanna aon-mhodh choncréite (do SSR gan athróga CSS)

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