Skip to content

Commit

Permalink
Remove unnecessary step with number separator from Color function
Browse files Browse the repository at this point in the history
AFAIK `object &= 0xFF_FF_FF;` was an unnecessary step, because

`object & 0xFF` is equivalent to `object & 0xFF_FF_FF & 0xFF` and
`(object >> 16) & 0xFF` is equivalent to `((object & 0xFF_FF_FF) >> 16) & 0xFF`

This should prevent the error described in https://github.com/Qix-/color/issues/204
  • Loading branch information
slaweet authored and Qix- committed Aug 4, 2021
1 parent 87b957a commit 4647eae
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ function Color(object, model) {
this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
} else if (typeof object === 'number') {
// This is always RGB - can be converted later on.
object &= 0xFF_FF_FF;
this.model = 'rgb';
this.color = [
(object >> 16) & 0xFF,
Expand Down

0 comments on commit 4647eae

Please sign in to comment.