Open chimericdream opened 11 months ago
Good point!
Hello, may I take this?
@chimericdream I wouldn't mind taking this on since I've been working on another PR to fix some color functions. Out of curiosity though, wouldn't MUI's darken
and lighten
helpers work for this use case?
import { darken, lighten } from '@mui/system';
const DARKEN_PERCENT = 33;
const LIGHTEN_PERCENT = 33;
const makeColor = (color: string, contrast: string) => ({
main: color,
light: lighten(color, LIGHTEN_PERCENT / 100),
dark: darken(color, DARKEN_PERCENT / 100),
contrastText: contrast,
});
@arronhunt they probably would, at least for my example above. However, it still wouldn't be possible to blend arbitrary colors, which is where color-mix
can get really powerful.
Summary 💡
I wanted to use CSS's
color-mix
function for my theme palette colors to simplify the process of creating all of the main/light/dark variants. However, it appears that thedecomposeColor
function doesn't yet support this.Examples 🌈
Motivation 🔦
Allowing us to use the native
color-mix
CSS function simplifies the creation of new themes.