Skip to content

pantoken-root / renderers/mui/src / toMuiTheme

Hàm: toMuiTheme() ​

toMuiTheme(tokens, mode?): PantokenThemeOptions

Thử nghiệm

Xây dựng tùy chọn chủ đề MUI từ một IR token.

Tham số ​

tokens ​

chỉ đọc Token[]

IR (ví dụ: từ @pantoken/tokens).

mode? ​

Mode = "light"

Chế độ màu nào để giải quyết (mặc định "light").

Trả về ​

PantokenThemeOptions

Tùy chọn sẵn sàng cho createTheme của MUI.

Ví dụ ​

Chủ đề theo từng thương hiệu, theo từng chế độ

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

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