-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Labels
customization: cssDesign CSS customizability.Design CSS customizability.customization: themeHigher level theming customizability.Higher level theming customizability.type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.
Description
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 the decomposeColor
function doesn't yet support this.
Examples 🌈
const DARKEN_PERCENT = 33;
const LIGHTEN_PERCENT = 33;
const makeColor = (color: string, contrast: string) => ({
main: color,
light: `color-mix(in hsl, ${color} ${LIGHTEN_PERCENT}%, #fff)`,
dark: `color-mix(in hsl, ${color} ${DARKEN_PERCENT}%, #000)`,
contrastText: contrast,
});
export const theme = createTheme({
palette: {
mode: 'dark',
primary: makeColor(..., '#fff'),
secondary: makeColor(..., '#000'),
error: makeColor(..., '#000'),
warning: makeColor(..., '#000'),
info: makeColor(..., '#000'),
success: makeColor(..., '#fff'),
},
...
});
Motivation 🔦
Allowing us to use the native color-mix
CSS function simplifies the creation of new themes.
felix-bohlin, phongphongg, oliviertassinari, wszgrcy and IsabelParedes
Metadata
Metadata
Assignees
Labels
customization: cssDesign CSS customizability.Design CSS customizability.customization: themeHigher level theming customizability.Higher level theming customizability.type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.