SassScriptFunctions::mix
Mixes two colours together.
Takes the average of each of the RGB components, optionally weighted by the given percentage. The opacity of the colours is also considered when weighting the components. The weight specifies the amount of the first colour that should be included in the returned colour. The default, 50%, means that half the first colour and half the second colour should be used. 25% means that a quarter of the first colour and three quarters of the second colour should be used. For example: mix(#f00, #00f) => #7f007f mix(#f00, #00f, 25%) => #3f00bf mix(rgba(255, 0, 0, 0.5), #00f) => rgba(63, 0, 191, 0.75)
Signature
public function mix(
$colour1,
$colour2,
[string
$weight = '50%'] )
Parameters
$colour1
—$colour2
—$weight
— string
Returns
- new
- SassColour The mixed colour
Errors/Exceptions
-
SassScriptFunctionException
- If $colour1 or $colour2 is