-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes RGB to/from YIQ conversion to use gamma-corrected RGB instead o…
…f linear, fixes #185 Updated docs in regards to sRGB/YIQ conversion
- Loading branch information
Showing
4 changed files
with
31 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import convertLrgbToRgb from '../lrgb/convertLrgbToRgb.js'; | ||
|
||
const convertYiqToRgb = ({ y, i, q, alpha }) => | ||
convertLrgbToRgb({ | ||
const convertYiqToRgb = ({ y, i, q, alpha }) => { | ||
const res = { | ||
mode: 'rgb', | ||
r: y + 0.95608445 * i + 0.6208885 * q, | ||
g: y - 0.27137664 * i - 0.6486059 * q, | ||
b: y - 1.10561724 * i + 1.70250126 * q, | ||
alpha | ||
}); | ||
b: y - 1.10561724 * i + 1.70250126 * q | ||
}; | ||
if (alpha !== undefined) res.alpha = alpha; | ||
return res; | ||
}; | ||
|
||
export default convertYiqToRgb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters