Skip to content

Commit

Permalink
Color: Clamp values in getHex(). (mrdoob#23582)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob authored and abernier committed Sep 16, 2022
1 parent 26740b7 commit cc2aa9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/math/Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class Color {

getHex() {

return ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;
return clamp( this.r * 255, 0, 255 ) << 16 ^ clamp( this.g * 255, 0, 255 ) << 8 ^ clamp( this.b * 255, 0, 255 ) << 0;

}

Expand Down

0 comments on commit cc2aa9c

Please sign in to comment.