change_color

change_color($color, [$red], [$green], [$blue], [$hue], [$saturation], [$lightness], [$alpha])

Changes one or more properties of a color. This can change the red, green, blue, hue, saturation, value, and alpha properties. The properties are specified as keyword arguments, and replace the color’s current value for that property.

All properties are optional. You can’t specify both RGB properties ($red, $green, $blue) and HSL properties ($hue, $saturation, $value) at the same time.

Examples:

change-color(#102030, $blue: 5) => #102005
change-color(#102030, $red: 120, $blue: 5) => #782005
change-color(hsl(25, 100%, 80%), $lightness: 40%, $alpha: 0.8) => hsla(25, 100%, 40%, 0.8)

Parameters:

  • $color (Color)
  • $red (Number) The new red component for the color, within 0 and 255 inclusive
  • $green (Number) The new green component for the color, within 0 and 255 inclusive
  • $blue (Number) The new blue component for the color, within 0 and 255 inclusive
  • $hue (Number) The new hue component for the color, in degrees
  • $saturation (Number) The new saturation component for the color, between 0% and 100% inclusive
  • $lightness (Number) The new lightness component for the color, within 0% and 100% inclusive
  • $alpha (Number) The new alpha component for the color, within 0 and 1 inclusive

Returns:

  • (Color)

Raises:

  • (ArgumentError) if any parameter is the wrong type or out-of bounds, or if RGB properties and HSL properties are adjusted at the same time
doc_Sass
2016-11-11 13:09:04
Comments
Leave a Comment

Please login to continue.