material-foundation / material-theme-builder

Visualize dynamic color and create a custom Material Theme.
https://material-foundation.github.io/material-theme-builder/
Apache License 2.0
361 stars 27 forks source link

MTB generates 'universally disliked' primary color for some inputs #253

Open MachFour opened 5 months ago

MachFour commented 5 months ago

Describe the bug Using the Material3 Theme builder, the generated primary color is sometimes "universally disliked" according to the Material Color Utilities DislikeAnalyzer.

To Reproduce Steps to reproduce the behavior:

  1. Go to either Material3 Theme Builder or Material Theme Builder
  2. Click on the 'Custom' tab and then 'Core Colors -> Primary'
  3. Enter #ffcd17 which is approx HCT(91.74, 60.87, 84.48)
  4. Observe generated primary color for Light scheme is #745b00 which is approx HCT(91.27, 38.37, 39.91)
  5. According to the Dislike Analyzer, colors which have Hue between 90 and 110, Chroma above 16, and Tone below 65 are "Universally disliked" (I too dislike it) and should be avoided. But the generated primary color is clearly in this region.

Expected behavior The generated primary color is not "universally disliked" and ideally closer to the color that I entered.

Screenshots 2024-01-26-13:45:06 2024-01-26-13:45:24

Desktop (please complete the following information):

Additional context It looks like the theme builder does a fixed transform on the entered color's chroma and tone, which for hues between 90 and 110, puts it into the 'disliked color' category. This should be fixed in order to better support primary hues between 90 and 110.