| Class | Color::YIQ |
| In: |
lib/color.rb
lib/color/yiq.rb |
| Parent: | Object |
A colour object representing YIQ (NTSC) colour encoding.
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 COLOR_TOLERANCE of each other.
# File lib/color/yiq.rb, line 44
44: def ==(other)
45: other = other.to_yiq
46: other.kind_of?(Color::YIQ) and
47: ((@y - other.y).abs <= Color::COLOR_TOLERANCE) and
48: ((@i - other.i).abs <= Color::COLOR_TOLERANCE) and
49: ((@q - other.q).abs <= Color::COLOR_TOLERANCE)
50: end
# File lib/color/yiq.rb, line 83
83: def inspect
84: "YIQ [%.2f%%, %.2f%%, %.2f%%]" % [ @y * 100, @i * 100, @q * 100 ]
85: end