File: sass_functions.rb

package info (click to toggle)
ruby-rails-admin 0.8.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,492 kB
  • ctags: 1,292
  • sloc: ruby: 5,341; makefile: 3
file content (18 lines) | stat: -rwxr-xr-x 557 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'sass'

module Sass
  module Script
    module Functions
      # LARS: Snatched from compass - 2011-11-29 - used for gradients in IE6-9
      # returns an IE hex string for a color with an alpha channel
      # suitable for passing to IE filters.
      def ie_hex_str(color)
        assert_type color, :Color
        alpha = (color.alpha * 255).round
        alphastr = alpha.to_s(16).rjust(2, '0')
        Sass::Script::String.new("##{alphastr}#{color.send(:hex_str)[1..-1]}".upcase)
      end
      declare :ie_hex_str, [:color]
    end
  end
end