Class | Color::YIQ |
In: |
lib/color.rb
lib/color/yiq.rb |
Parent: | Object |
A colour object representing YIQ (NTSC) colour encoding.
i | [RW] | |
q | [RW] | |
y | [RW] |
Compares the other colour to this one. The other colour will be converted to YIQ before comparison, so the comparison between a YIQ colour and a non-YIQ colour will be approximate and based on the other colour‘s to_yiq conversion. If there is no to_yiq conversion, this will raise an exception. This will report that two YIQ values are equivalent if all component colours are within 1e-4 (0.0001) of each other.
# File lib/color/yiq.rb, line 41 41: def ==(other) 42: other = other.to_yiq 43: other.kind_of?(Color::YIQ) and 44: ((@y - other.y).abs <= 1e-4) and 45: ((@i - other.i).abs <= 1e-4) and 46: ((@q - other.q).abs <= 1e-4) 47: end