Module: LIFX::Colors

Included in:
Color
Defined in:
lib/lifx/color.rb

Constant Summary collapse

DEFAULT_KELVIN =
3500

Instance Method Summary collapse

Instance Method Details

#random_color(hue: rand(360), saturation: rand, brightness: rand, kelvin: DEFAULT_KELVIN) ⇒ Object

Helper to create a random LIFX::Color



29
30
31
# File 'lib/lifx/color.rb', line 29

def random_color(hue: rand(360), saturation: rand, brightness: rand, kelvin: DEFAULT_KELVIN)
  Color.new(hue, saturation, brightness, kelvin)
end

#white(brightness: 1.0, kelvin: DEFAULT_KELVIN) ⇒ Color

Helper to create a white LIFX::Color

Parameters:

  • brightness: (Float) (defaults to: 1.0)

    Valid range: 0..1

  • kelvin: (Integer) (defaults to: DEFAULT_KELVIN)

    Valid range: 2500..9000

Returns:



24
25
26
# File 'lib/lifx/color.rb', line 24

def white(brightness: 1.0, kelvin: DEFAULT_KELVIN)
  Color.new(0, 0, brightness, kelvin)
end