Skip to content

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

دالة: toStyledTheme() ​

toStyledTheme(tokens, options?): StyledTheme

Experimental

بناء كائن سمة CSS-in-JS من تمثيل IR للرموز.

Parameters ​

tokens ​

للقراءة فقط Token[]

IR (مثلاً من @pantoken/tokens).

options? ​

ToStyledThemeOptions = {}

ToStyledThemeOptions.

Returns ​

StyledTheme

كائن السمة، مفهرس بأسماء الرموز بصيغة camelCase.

Examples ​

مدعوم بـ var()، تدفقات الوضع الفاتح/الداكن عبر @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)"

تجهيز قيم ثابتة بنمط واحد (لـ SSR بدون متغيرات 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()