Sha256: 859a1aec3a942556b19a13fcf00bf2ca6e071af43e1825b7d6408bebd8763089

Contents?: true

Size: 325 Bytes

Versions: 1

Compression:

Stored size: 325 Bytes

Contents

class Color::RGBA < Color::RGB

  # @param col [String] e.g. '#1a1a1a'
  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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coloration-0.4.0 lib/coloration/color_rgba.rb