Skip to content

pantoken / renderers/mui/src / toMuiTheme

ฟังก์ชัน: toMuiTheme()

toMuiTheme(tokens, mode?): PantokenThemeOptions

ทดลอง

สร้างตัวเลือกธีม MUI จาก token IR.

พารามิเตอร์

tokens

อ่านอย่างเดียว Token[]

IR (เช่น จาก @pantoken/tokens)

mode?

Mode = "light"

เลือกโหมดสีที่จะทำการแก้ไข (ค่าปริยาย "light").

คืนค่า

PantokenThemeOptions

ตัวเลือกที่พร้อมสำหรับ createTheme ของ MUI.

ตัวอย่าง

ธีมแยกตามแบรนด์และโหมด

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

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