Skip to content

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

Swyddogaeth: toStyledTheme()

toStyledTheme(tokens, options?): StyledTheme

Arbrofol

Adeiladu gwrthrych thema CSS-in-JS o IR tocyn.

Paramedrau

tokens

darllen-yn-unig Token[]

Yr IR (er enghraifft o @pantoken/tokens).

options?

ToStyledThemeOptions = {}

ToStyledThemeOptions.

Yn dychwelyd

StyledTheme

Y gwrthrych thema, gyda allweddi wedi'u ffurfio o enwau tocyn mewn camelCase.

Enghreifftiau

Wedi'i gefnogi gan var(), llifoedd golau/tywyll trwy @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)"

Creu gwerthoedd un-modd pendant (ar gyfer SSR heb newidynnau 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()