Sha256: 3741c2f7dd66c8f12be704708bce6794f3b2e8100503beee0145cd89c723b2a4

Contents?: true

Size: 425 Bytes

Versions: 2

Compression:

Stored size: 425 Bytes

Contents

# Color number generates hex string without '#' symbol for IE filters
module Wiskey::SassExtensions::Functions::ColorNumber

  def color_number(color)
    rgb_color = Sass::Script::Color::COLOR_NAMES[color.to_s] || (0..2).map {|n| color.to_s.gsub(/^#/, '').to_i(16) >> (n << 3) & 0xff}.reverse
    sass_color = Sass::Script::Color.new rgb_color

    Sass::Script::String.new sass_color.inspect.to_s.gsub(/^#/, '')
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wiskey-0.0.9 lib/wiskey/sass_extensions/functions/color_number.rb
wiskey-0.0.8 lib/wiskey/sass_extensions/functions/color_number.rb