Skip to content

Commit

Permalink
monet: Fix overly low chroma for tones below 90
Browse files Browse the repository at this point in the history
Chroma is capped to 40 for light colors of L* 90 and above for valid
reasons. However, assigning the capped value to "chroma" fails to
account for the fact that chroma is an argument passed to the method,
so the capping effect persists across iterations. This unintentionally
affects and limits the chroma of *all* shades because the first
iteration of the loop is L*=90.

As a result, almost all colors are less chromatic than the intended
chroma >= 48. Fix the issue by assigning capped chroma to a temporary
per-iteration variable.

Change-Id: I18102d0072c89535e27f23fdb98af7c83864ff7e
  • Loading branch information
kdrag0n committed Jun 7, 2022
1 parent ae155c0 commit e23fc2f
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ public class Shades {
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);
float shadeChroma = (lStar >= 90) ? Math.min(40f, chroma) : chroma;
shades[i] = ColorUtils.CAMToColor(hue, shadeChroma, lStar);
}
return shades;
}
Expand Down

0 comments on commit e23fc2f

Please sign in to comment.