Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0789a7d6 authored by James O'Leary's avatar James O'Leary
Browse files

[CP] Use chroma max of 40 at tone 90

Bug: 199389758
Test: atest ColorSchemeTest
Change-Id: I295ef3a6ad4d64c26ef150c853ec9875cf2ad8ff
parent a7efb5e0
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -53,10 +53,15 @@ public class Shades {
     */
    public static @ColorInt int[] of(float hue, float chroma) {
        int[] shades = new int[12];
        shades[0] = ColorUtils.CAMToColor(hue, chroma, 99);
        shades[1] = ColorUtils.CAMToColor(hue, chroma, 95);
        // At tone 90 and above, blue and yellow hues can reach a much higher chroma.
        // To preserve a consistent appearance across all hues, use a maximum chroma of 40.
        shades[0] = ColorUtils.CAMToColor(hue, Math.min(40f, chroma), 99);
        shades[1] = ColorUtils.CAMToColor(hue, Math.min(40f, chroma), 95);
        for (int i = 2; i < 12; i++) {
            float lStar = (i == 6) ? MIDDLE_LSTAR : 100 - 10 * (i - 1);
            if (lStar >= 90) {
                chroma = Math.min(40f, chroma);
            }
            shades[i] = ColorUtils.CAMToColor(hue, chroma, lStar);
        }
        return shades;