Method: Sass::Script::Functions#darken_percent

Defined in:
lib/compass-colors/sass_extensions.rb

#darken_percent(color, amount) ⇒ Object

Takes a color object and percent by which to darken it (0 to 100).



26
27
28
29
30
31
32
33
34
35
# File 'lib/compass-colors/sass_extensions.rb', line 26

def darken_percent(color, amount)
  Compass::Util.compass_warn("darken-percent() is deprecated. Please use the scale-color() function provided by sass.")
  if unitless(amount).to_bool
    Compass::Util.compass_warn("Sass's scale-color() function requires a percent instead of a unitless number for the amount.")
    amount = Sass::Script::Number.new(-amount.value, ['%'], [])
  else
    amount = amount.times(Sass::Script::Number.new(-1))
  end
  scale_color(color, "lightness" => amount)
end