Sha256: f5ee91e10e19aa94405e5f4b36274a7ae5edb1489e9cb735604281b13b2e95c7

Contents?: true

Size: 540 Bytes

Versions: 84

Compression:

Stored size: 540 Bytes

Contents

require "sass"

module Sass::Script::Functions
  # returns an IE hex string for a color with an alpha channel
  # suitable for passing to IE filters.
  # see http://msdn.microsoft.com/en-us/library/ms532930%28v=vs.85%29.aspx
  def ie_hex_str(color)
    assert_type color, :Color
    alpha = (color.alpha * 255).round
    alpha = alpha.to_s(16).rjust(2, '0')
    color_string = color.rgb.map {|num| num.to_s(16).rjust(2, '0')} .join

    Sass::Script::String.new("##{alpha}#{color_string}")
  end
  declare :ie_hex_str, :args => [:color]
end

Version data entries

84 entries across 84 versions & 3 rubygems

Version Path
anjlab-bootstrap-rails-2.3.1.2 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.3.1.1 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.3.1.0 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.3.0.0 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.2.2.1 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.2.2.0 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.2.2.rc1 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.2.2.rc lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.2.1.2 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.2.1.1 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.2.1.0 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.2.0.0 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.1.1.1 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.1.1.0 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.1.0.5 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.1.0.4 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.1.0.3 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.1.0.2 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.1.0.1 lib/bootstrap-rails/ie_hex_str.rb
anjlab-bootstrap-rails-2.1.0.0 lib/bootstrap-rails/ie_hex_str.rb