Sha256: 344c9e7be6877cf1024e62ee4271d5c3934f37848f066ff5ff581fa1bb3446f3
Contents?: true
Size: 521 Bytes
Versions: 73
Compression:
Stored size: 521 Bytes
Contents
# frozen_string_literal: true # rgb utility class Atome def rgb_html(string) # ` # col = w3color(#{string}); # rgb_col=col.toRgb(); # return Opal.hash(rgb_col) # ` js_code = <<-JS var col = w3color('#{string}'); var rgb_col = col.toRgb(); return rgb_col; JS JS.eval(js_code) end def to_rgb(string) rgb_color = rgb_html(string) { red: rgb_color[:r] / 255, green: rgb_color[:g] / 255, blue: rgb_color[:b] / 255, alpha: 1 } end end
Version data entries
73 entries across 73 versions & 1 rubygems