Sha256: 0fb4f3b5769e23a5f1d2c2dc6d96f851c06d22004343c6981bcf4025879ae416

Contents?: true

Size: 366 Bytes

Versions: 23

Compression:

Stored size: 366 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)
 `
  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

23 entries across 23 versions & 1 rubygems

Version Path
atome-0.5.4.1.9 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.4.1.7 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.4.1.3 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.4.1.2 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.4.1.1 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.4.1.0 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.4.0.9 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.3.8.8 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.3.8.1 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.3.8.0 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.3.7.8 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.3.7.3 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.3.7.2 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.3.4 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.3.2 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.2.8 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.2.7 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.2.5 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.1.9 lib/atome/renderers/opal/extensions/color.rb
atome-0.5.1.4 lib/atome/renderers/opal/extensions/color.rb