Method: Cheers::Color#initialize
- Defined in:
- lib/cheers/color.rb
#initialize(color = '#000000') ⇒ Color
Create new color from a hex value
8 9 10 11 12 13 |
# File 'lib/cheers/color.rb', line 8 def initialize(color = '#000000') hex_string = color[1..6] self.r = hex_string[0..1].to_i(16) self.g = hex_string[2..3].to_i(16) self.b = hex_string[4..5].to_i(16) end |