Class: Overcast::Color
- Inherits:
-
Object
- Object
- Overcast::Color
- Defined in:
- lib/overcast.rb
Overview
Your code goes hereā¦
Class Method Summary collapse
Class Method Details
.darken(hex, amount = 0.5) ⇒ Object
6 7 8 9 10 |
# File 'lib/overcast.rb', line 6 def self.darken(hex, amount=0.5) hex = remove_pound(hex) rgb = convert_to_rgb(hex).map{|element| element * amount } convert_to_hex(rgb) end |
.lighten(hex, amount = 0.5) ⇒ Object
12 13 14 15 16 |
# File 'lib/overcast.rb', line 12 def self.lighten(hex, amount=0.5) hex = remove_pound(hex) rgb = convert_to_rgb(hex).map{ |element| [(element + 255 * amount).round, 255].min } convert_to_hex(rgb) end |