Skip to content

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

फंक्शन: toStyledTheme()

toStyledTheme(tokens, options?): StyledTheme

प्रयोगात्मक

टोकन IR से CSS-in-JS थीम ऑब्जेक्ट बनाएं।

पैरामीटर

tokens

readonly Token[]

IR (उदा. @pantoken/tokens से).

options?

ToStyledThemeOptions = {}

ToStyledThemeOptions.

वापसी

StyledTheme

थीम ऑब्जेक्ट, जिसकी कुंजी camelCased टोकन नाम है।

उदाहरण

var()-समर्थित, light/dark प्रवाह @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)"

ठोस single-mode मान बनाएँ (CSS वेरिएबल के बिना SSR के लिए)

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