mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.03k stars 1.24k forks source link

[charts] Improve default color contrast in dark mode #13880

Open alexfauquette opened 1 month ago

alexfauquette commented 1 month ago

I'm not sold on the color contrast in dark mode https://deploy-preview-13859--material-ui-x.netlify.app/x/react-charts/zoom-and-pan/#zooming-options, both series looks hard to separate.

SCR-20240718-beyk

Originally posted by @oliviertassinari in https://github.com/mui/mui-x/issues/13859#issuecomment-2234480917

I agree on this point, but to change default colors we should wait for v8

Search keywords:

JCQuintas commented 1 month ago

@alexfauquette we can change the colors on the docs though, without changing the default values on the Lib

alexfauquette commented 1 month ago

It would implies to have in each demo a prop colors={nextDefaultColors}

I'm not a big fan. Even if the colors are not perfect the demos should represent what the user will get

JCQuintas commented 1 month ago

Ah, nvm then, I thought we had a way to override the entire theme πŸ˜…

alexfauquette commented 1 month ago

We could support defaultProps on the container, and then update it. But how many users will spend their time wondering why their charts are not like the ones in the documentation πŸ™ˆ

If I copy the code of a demo and want to see the same result. Not having to figure out they internally have a custom theme that modifies colors

oliviertassinari commented 1 month ago

I feel like the issue is with the palette itself, I struggle with the contrast of https://mui.com/x/react-charts/zoom-and-pan/#zooming-options in dark mode too.

To illustrate it, I feel like there are opportunities to make the make color feel more contrasting and still balances when shown next to each other. For example, on my Apple XHR screen. This makes the first 3 colors feel more balanced when on a pie charts, light and dark mode.

diff --git a/packages/x-charts/src/colorPalettes/colorPalettes.ts b/packages/x-charts/src/colorPalettes/colorPalettes.ts
index e22801d29..da65aacad 100644
--- a/packages/x-charts/src/colorPalettes/colorPalettes.ts
+++ b/packages/x-charts/src/colorPalettes/colorPalettes.ts
@@ -4,13 +4,13 @@ export type ChartsColorPalette = string[] | ChartsColorPaletteCallback;
 export const blueberryTwilightPaletteLight = [
   '#02B2AF',
-  '#2E96FF',
-  '#B800D8',
+  '#148AFF',
+  '#BF00E0',
   '#60009B',
   '#2731C8',
   '#03008D',
 ];
 export const blueberryTwilightPaletteDark = [
-  '#02B2AF',
+  '#5BD399',
   '#72CCFF',
   '#DA00FF',
   '#9001CB',

https://mui.com/x/react-charts/styling/#color-palette

I suspect we should leave it like this for now, and have a designer tweak all the values at once.

flaviendelangle commented 1 month ago

Ah, nvm then, I thought we had a way to override the entire theme

If we don't have a way to do it, it would be nice to add one, overriding the colors on all the charts in my app seems to be something I would like :+1:

oliviertassinari commented 1 month ago

From https://www.notion.so/mui-org/2024-React-Summit-Trip-report-2a247a488bac4c97995c81fa710df586?pvs=4#3282d07658bc460ca0a5de72b1f78de9

Using Highchart but it feels like the UI is outdated, it feels like it hasn't changed for a long time, it’s 10 years old. We had to customize it.

There could be some value in having design bandwidth focused on this, e.g. #9980

Benchmark


I suspect that the ideal would be to have in the long run:

alexfauquette commented 1 month ago

We already have 3 palettes thanks to @noraleonte :)

I think "blueberry" is made for material, and "cheerfull-fiesta" is for joy πŸ˜‰

https://mui.com/x/react-charts/styling/#color-palette image

noraleonte commented 1 month ago

@alexfauquette Would it make sense to take another look at the color palettes now that we have more types of charts than we had when we first created them?