Method: Sass::Script::Functions#transparentize

Defined in:
lib/sass/script/functions.rb

#transparentize($color, $amount) ⇒ Color Also known as: fade_out

Makes a color more transparent. Takes a color and a number between 0 and 1, and returns a color with the opacity decreased by that amount.

Examples:

transparentize(rgba(0, 0, 0, 0.5), 0.1) => rgba(0, 0, 0, 0.4)
transparentize(rgba(0, 0, 0, 0.8), 0.2) => rgba(0, 0, 0, 0.6)

Parameters:

  • $color (Color)
  • $amount (Number)

    The amount to decrease the opacity by, between 0 and 1

Returns:

Raises:

  • (ArgumentError)

    if $amount is out of bounds, or either parameter is the wrong type

See Also:



670
671
672
# File 'lib/sass/script/functions.rb', line 670

def transparentize(color, amount)
  _adjust(color, amount, :alpha, 0..1, :-)
end