Skip to content

Commit 2d03f10

Browse files
author
mlarghydracept
committed
Constrain HSB values after parsing for pattern #1826
1 parent 62a7f72 commit 2d03f10

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/color/p5.Color.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@ p5.Color._parseInputs = function() {
537537
return parseInt(color, 10) / 100;
538538
});
539539
}
540+
results = results.map(function(value) {
541+
return Math.max(Math.min(value, 1), 0);
542+
});
540543
if (results.length) {
541544
return color_conversion._hslaToRGBA(results);
542545
}
@@ -563,7 +566,6 @@ p5.Color._parseInputs = function() {
563566
return parseInt(color, 10) / 100;
564567
});
565568
}
566-
567569
results = results.map(function(value) {
568570
return Math.max(Math.min(value, 1), 0);
569571
});

0 commit comments

Comments
 (0)