colorMix
🧪 Mixes two colors together.
Syntax
TypeScript
import { colorMix } from '@opentf/std'; colorMix({ color1: any; color2: any; weight?: number; to?: ColorFormat }): any
color1: The first color.color2: The second color.weight: The weight of the first color between0and1(default:0.5).to: The output format (default:'hex').
Examples
TypeScript
colorMix({ color1: 'white', color2: 'black' }); //=> '#808080' colorMix({ color1: 'red', color2: 'blue' }); //=> '#800080' colorMix({ color1: 'red', color2: 'blue', weight: 0.25 }); //=> '#4000bf'