Skip to content

Function: mix()

ts
function mix(
   a, 
   b, 
   weight?): string;

Mixes two hex colors together. weight (0–1) controls how much of b is blended in; default is 0.5 (equal mix).

Parameters

ParameterTypeDefault value
astringundefined
bstringundefined
weightnumber0.5

Returns

string

Example

ts
mix('#ff0000', '#0000ff', 0.5) // => '#7f007f'

Since

1.0.0

Released under the MIT License.