Module: LIFX::LAN::Colors

Included in:
Color
Defined in:
lib/lifx/lan/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::LAN::Color


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

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::LAN::Color

Parameters:

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

    Valid range: 0..1

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

    Valid range: 2500..9000

Returns:


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

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