Class: SparkleMotion::LaunchPad::Color
- Inherits:
-
Object
- Object
- SparkleMotion::LaunchPad::Color
- Defined in:
- lib/sparkle_motion/launch_pad/color.rb,
lib/sparkle_motion/launch_pad/color.rb
Overview
Color classes for the Novation Launchpad Mk 2, which supports 4 bits per color element in RGB mode.
Constant Summary collapse
- BLACK =
new(0x00, 0x00, 0x00).freeze
- DARK_GRAY =
new(0x07, 0x07, 0x07).freeze
- LIGHT_GRAY =
new(0x27, 0x27, 0x27).freeze
- WHITE =
new(0x3F, 0x3F, 0x3F).freeze
- RED =
new(0x3F, 0x00, 0x00).freeze
- DARK_GREEN =
new(0x00, 0x07, 0x00).freeze
- GREEN =
new(0x00, 0x3F, 0x00).freeze
- LIGHT_GREEN =
new(0x10, 0x4F, 0x10).freeze
- BLUE =
new(0x00, 0x00, 0x3F).freeze
Instance Attribute Summary collapse
-
#b ⇒ Object
readonly
Returns the value of attribute b.
-
#g ⇒ Object
readonly
Returns the value of attribute g.
-
#r ⇒ Object
readonly
Returns the value of attribute r.
Instance Method Summary collapse
-
#initialize(r, g, b) ⇒ Color
constructor
A new instance of Color.
- #to_h ⇒ Object
Constructor Details
#initialize(r, g, b) ⇒ Color
Returns a new instance of Color.
7 8 9 10 11 |
# File 'lib/sparkle_motion/launch_pad/color.rb', line 7 def initialize(r, g, b) @r = clamp_elem(r) @g = clamp_elem(g) @b = clamp_elem(b) end |
Instance Attribute Details
#b ⇒ Object (readonly)
Returns the value of attribute b.
6 7 8 |
# File 'lib/sparkle_motion/launch_pad/color.rb', line 6 def b @b end |
#g ⇒ Object (readonly)
Returns the value of attribute g.
6 7 8 |
# File 'lib/sparkle_motion/launch_pad/color.rb', line 6 def g @g end |
#r ⇒ Object (readonly)
Returns the value of attribute r.
6 7 8 |
# File 'lib/sparkle_motion/launch_pad/color.rb', line 6 def r @r end |
Instance Method Details
#to_h ⇒ Object
13 14 15 16 17 |
# File 'lib/sparkle_motion/launch_pad/color.rb', line 13 def to_h { r: r, g: g, b: b } end |