Class: Kolors::Rgb
- Inherits:
-
Object
- Object
- Kolors::Rgb
- Defined in:
- lib/kolors/rgb.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
readonly
Returns the value of attribute a.
-
#b ⇒ Object
readonly
Returns the value of attribute b.
-
#g ⇒ Object
readonly
Returns the value of attribute g.
-
#l ⇒ Object
readonly
Returns the value of attribute l.
-
#r ⇒ Object
readonly
Returns the value of attribute r.
Instance Method Summary collapse
-
#initialize(r, g, b) ⇒ Rgb
constructor
A new instance of Rgb.
-
#to_lab ⇒ Object
EasyRGB - RGB to LAB - LAB gives us a perceptually accurate colorspace.
Constructor Details
#initialize(r, g, b) ⇒ Rgb
Returns a new instance of Rgb.
6 7 8 9 10 |
# File 'lib/kolors/rgb.rb', line 6 def initialize(r,g,b) @r = r @g = g @b = b end |
Instance Attribute Details
#a ⇒ Object (readonly)
Returns the value of attribute a.
4 5 6 |
# File 'lib/kolors/rgb.rb', line 4 def a @a end |
#b ⇒ Object (readonly)
Returns the value of attribute b.
3 4 5 |
# File 'lib/kolors/rgb.rb', line 3 def b @b end |
#g ⇒ Object (readonly)
Returns the value of attribute g.
3 4 5 |
# File 'lib/kolors/rgb.rb', line 3 def g @g end |
#l ⇒ Object (readonly)
Returns the value of attribute l.
4 5 6 |
# File 'lib/kolors/rgb.rb', line 4 def l @l end |
#r ⇒ Object (readonly)
Returns the value of attribute r.
3 4 5 |
# File 'lib/kolors/rgb.rb', line 3 def r @r end |
Instance Method Details
#to_lab ⇒ Object
EasyRGB - RGB to LAB
-
LAB gives us a perceptually accurate colorspace
14 15 16 17 |
# File 'lib/kolors/rgb.rb', line 14 def to_lab x,y,z = rgb_to_xyz(@r,@g,@b) l,a,b = xyz_to_lab(x,y,z) end |