Class: ColorDifference::Color

Inherits:
Struct
  • Object
show all
Defined in:
lib/color_difference/color.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blueObject

Returns the value of attribute blue

Returns:

  • (Object)

    the current value of blue



2
3
4
# File 'lib/color_difference/color.rb', line 2

def blue
  @blue
end

#greenObject

Returns the value of attribute green

Returns:

  • (Object)

    the current value of green



2
3
4
# File 'lib/color_difference/color.rb', line 2

def green
  @green
end

#redObject

Returns the value of attribute red

Returns:

  • (Object)

    the current value of red



2
3
4
# File 'lib/color_difference/color.rb', line 2

def red
  @red
end

Instance Method Details

#aObject



7
8
9
# File 'lib/color_difference/color.rb', line 7

def a
  @a ||= 500.0 * (lab_x - lab_y)
end

#bObject



11
12
13
# File 'lib/color_difference/color.rb', line 11

def b
  @b ||= 200.0 * (lab_y - lab_z)
end

#lObject



3
4
5
# File 'lib/color_difference/color.rb', line 3

def l
  @l ||= (116.0 * lab_y) - 16.0
end

#xObject



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

#yObject



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

#zObject



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