Skip to content

pantoken / renderers/mui/src / toMuiTheme

函式: toMuiTheme()

toMuiTheme(tokens, mode?): PantokenThemeOptions

實驗性

從代幣 IR 建構 MUI 主題選項。

參數

tokens

唯讀 Token[]

IR(例如來自 @pantoken/tokens)。

mode?

Mode = "light"

要解析為哪種顏色模式(預設為 "light")。

回傳

PantokenThemeOptions

供 MUI 的 createTheme 使用的選項已準備好。

範例

依品牌、依模式的主題

ts
import { createTheme } from "@mui/material/styles";
import { toMuiTheme } from "@pantoken/mui";
import { byTheme } from "@pantoken/tokens";

const darkCanvas = createTheme(toMuiTheme(byTheme("canvas"), "dark"));