Skip to content

Commit 1b97faf

Browse files
committed
model: Add a clamping step in iconOnBarBackground that might be unnecessary
We'll get an error if `clamped20to75AsHsl.lightness - 0.12` ends up being below 0.0 or above 1.0... ...which probably can't happen? The value `clamped20to75AsHsl.lightness` is the "L" of an HSL representation of a certain color. That certain color is *supposed* to be the result of clamping an *LCH* "L" value between 20 and 75...but it actually comes from clamping a LAB color's "L" value between those numbers...but we have a comment saying the "L" axis might be the same between LCH and LAB... ...but I think HSL "L" probably doesn't match either LCH "L" or LAB "L"...which still might not matter in this case? Anyway, with some uncertainty, it seems like it might be wise to do this clamping to avoid an error.
1 parent c3a3544 commit 1b97faf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/api/model/model.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ ColorSwatch<StreamColor> streamColorSwatch(int base) {
494494
// TODO fix bug where our results differ from the replit's (see unit tests)
495495
StreamColor.iconOnBarBackground:
496496
clamped20to75AsHsl
497-
.withLightness(clamped20to75AsHsl.lightness - 0.12)
497+
.withLightness((clamped20to75AsHsl.lightness - 0.12).clamp(0.0, 1.0))
498498
.toColor(),
499499

500500
// Follows `.recepient` in Vlad's replit:

0 commit comments

Comments
 (0)