Class: Color::RGBA

Inherits:
RGB show all
Defined in:
lib/coloration/color_rgba.rb

Class Method Summary collapse

Class Method Details

.from_html(col, bg) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/coloration/color_rgba.rb', line 2

def self.from_html(col, bg)
  if col.size > 7 # we have color with alpha channel
    alpha = (100 * ((col[-2..-1]).to_i(16) / 255.0)).to_i
    color = super(col[0..-3])
    color.mix_with(bg, alpha)
  else
    super(col)
  end
end