Skip to content

Commit

Permalink
Test if alpha is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydk committed Feb 6, 2024
1 parent 6c0f360 commit 03562cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class Color {
this.coords = coords ? coords.slice() : [0, 0, 0];

// Clamp alpha to [0, 1]
this.alpha = 0 <= alpha && alpha <= 1 ? alpha : 1;
this.alpha = alpha > 1 || alpha === undefined ? 1 : (alpha < 0 ? 0 : alpha);

// Convert "NaN" to NaN
for (let i = 0; i < this.coords.length; i++) {
Expand Down

0 comments on commit 03562cd

Please sign in to comment.