Class: ColorDifference::Color
- Inherits:
-
Struct
- Object
- Struct
- ColorDifference::Color
- Defined in:
- lib/color_difference/color.rb
Instance Attribute Summary collapse
-
#blue ⇒ Object
Returns the value of attribute blue.
-
#green ⇒ Object
Returns the value of attribute green.
-
#red ⇒ Object
Returns the value of attribute red.
Instance Method Summary collapse
Instance Attribute Details
#blue ⇒ Object
Returns the value of attribute blue
2 3 4 |
# File 'lib/color_difference/color.rb', line 2 def blue @blue end |
#green ⇒ Object
Returns the value of attribute green
2 3 4 |
# File 'lib/color_difference/color.rb', line 2 def green @green end |
#red ⇒ Object
Returns the value of attribute red
2 3 4 |
# File 'lib/color_difference/color.rb', line 2 def red @red end |
Instance Method Details
#a ⇒ Object
7 8 9 |
# File 'lib/color_difference/color.rb', line 7 def a @a ||= 500.0 * (lab_x - lab_y) end |
#b ⇒ Object
11 12 13 |
# File 'lib/color_difference/color.rb', line 11 def b @b ||= 200.0 * (lab_y - lab_z) end |
#l ⇒ Object
3 4 5 |
# File 'lib/color_difference/color.rb', line 3 def l @l ||= (116.0 * lab_y) - 16.0 end |
#x ⇒ Object
15 16 17 |
# File 'lib/color_difference/color.rb', line 15 def x @x ||= 0.4124 * xyz_r + 0.3576 * xyz_g + 0.1805 * xyz_b end |
#y ⇒ Object
19 20 21 |
# File 'lib/color_difference/color.rb', line 19 def y @y ||= 0.2126 * xyz_r + 0.7152 * xyz_g + 0.0722 * xyz_b end |
#z ⇒ Object
23 24 25 |
# File 'lib/color_difference/color.rb', line 23 def z @z ||= 0.0193 * xyz_r + 0.1192 * xyz_g + 0.9505 * xyz_b end |