# mui v5 如何複寫 Palette? 首先[官方文件](https://mui.com/material-ui/customization/palette/)中有定義 **PaletteColor** 的 Interface如下 ```typescript= interface PaletteColor { light?: string; main: string; dark?: string; contrastText?: string; } ``` 我們可以得知 **main** 是 required 的根據官方的解釋以下都三個參數是由 **main** 計算出(假如你沒有為它提供參數) - **light** - **dark** - **contrastText** **But!!** 如果你今天想要定義的是 Customization Palette Color,最好是將四個參數都傳入,因為你不曉得你使用到的組件會使用哪個參數,假如今天是 Chip,恭喜你,少傳入一個參數都會錯誤,因為他四種都會用到,可能是 fontColor, :hover, fill, outlined。 ```typescript= <Chip color="custom" /> ``` [參考](https://mui.com/material-ui/customization/palette/)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up