Method: Sass::Script::Value::Color#to_s
- Defined in:
- lib/sass/script/value/color.rb
#to_s(opts = {}) ⇒ String Also known as: to_sass
Returns a string representation of the color. This is usually the color's hex value, but if the color has a name that's used instead.
564 565 566 567 568 569 570 571 572 573 574 |
# File 'lib/sass/script/value/color.rb', line 564
def to_s(opts = {})
return smallest if options[:style] == :compressed
return representation if representation
# IE10 doesn't properly support the color name "transparent", so we emit
# generated transparent colors as rgba(0, 0, 0, 0) in favor of that. See
# #1782.
return rgba_str if Number.basically_equal?(alpha, 0)
return name if name
alpha? ? rgba_str : hex_str
end
|