pantoken / renderers/mui/src / toMuiTheme
Function: toMuiTheme()
toMuiTheme(
tokens,mode?):PantokenThemeOptions
Experimental
Build MUI theme options from a token IR.
Parameters
tokens
readonly Token[]
The IR (e.g. from @pantoken/tokens).
mode?
Mode = "light"
Which colour mode to resolve (default "light").
Returns
Options ready for MUI's createTheme.
Example
Per-brand, per-mode theme
ts
import { createTheme } from "@mui/material/styles";
import { toMuiTheme } from "@pantoken/mui";
import { byTheme } from "@pantoken/tokens";
const darkCanvas = createTheme(toMuiTheme(byTheme("canvas"), "dark"));