simple handle the color code
Add this line to your application's Gemfile:
gem 'color_code'
And then execute:
$ bundle
Or install it yourself as:
$ gem install color_code
rgb = ColorCode::RGB.new(r: 255, g: 0, b: 0)
rgb.to_s # => '#ff0000'
rbg.to_hash # => { r: 255, g: 0, b: 0 }
hsv = ColorCode::HSV.new(h: 0, s: 100, v: 100)
hsv.to_s # => '#ff0000'
hsv.to_hash # => { h: 0, s: 100, v: 100 }
hsl = ColorCode::HSL.new(h: 0, s: 100, l: 50)
hsl.to_s # => '#ff0000'
hsl.to_hash # => { h: 0, s: 100, l: 50 }
rgb = ColorCode::RGB.new(r: 255, g: 0, b: 0)
rgb.to_s # => '#ff0000'
hsv = rgb.to_hsv
hsv.to_s # => '#ff0000'
hsv = ColorCode::HSV.new(h: 0, s: 100, v: 100)
hsv.to_s # => '#ff0000'
rgb = hsv.to_rgb
rgb.to_s # => '#ff0000'
rgb = ColorCode::RGB.new(r: 255, g: 0, b: 0)
rgb.to_s # => '#ff0000'
hsl = rgb.to_hsl
hsl.to_s # => '#ff0000'
hsl = ColorCode::HSL.new(h: 0, s: 100, l: 50)
hsl.to_s # => '#ff0000'
rgb = hsl.to_rgb
rgb.to_s # => '#ff0000'
- Fork it ( https://github.com/shiro16/color_code/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request