Skip to main content

mix

function

Mix two colors together. Uses linear interpolation in RGB space.

function mix(color1: string, color2: string, weight: number): string

Import

import { mix } from '@modular/sdk';

Notes

returns
The mixed color as hex or rgba string
throws
Error if color formats are invalid or weight is out of range
example
```ts mix('#ff0000', '#0000ff', 0.5) // => '#800080' mix('#ffffff', '#000000', 0.5) // => '#808080' ```