Class: Chroma::ColorModes::Hsl

Inherits:
Object
  • Object
show all
Defined in:
lib/chroma/color_modes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h, s, l, a = 1) ⇒ Hsl

Returns a new instance of Hsl.

Parameters:

  • h (Numeric)
  • s (Numeric)
  • l (Numeric)
  • a (Numeric) (defaults to: 1)


8
9
10
# File 'lib/chroma/color_modes.rb', line 8

def initialize(h, s, l, a = 1)
  @h, @s, @l, @a = h, s, l, a
end

Instance Attribute Details

#aObject

Returns the value of attribute a.



2
3
4
# File 'lib/chroma/color_modes.rb', line 2

def a
  @a
end

#hObject

Returns the value of attribute h.



2
3
4
# File 'lib/chroma/color_modes.rb', line 2

def h
  @h
end

#lObject

Returns the value of attribute l.



2
3
4
# File 'lib/chroma/color_modes.rb', line 2

def l
  @l
end

#sObject

Returns the value of attribute s.



2
3
4
# File 'lib/chroma/color_modes.rb', line 2

def s
  @s
end

Instance Method Details

#to_aArray<Numeric> Also known as: to_ary

Returns the values h, s, l, and a as an array.

Returns:

  • (Array<Numeric>)


15
16
17
# File 'lib/chroma/color_modes.rb', line 15

def to_a
  [@h, @s, @l, @a]
end