UNPKG

@mirawision/colorize

Version:

A comprehensive color manipulation library for TypeScript, providing functionalities for color conversion, validation, gradient generation, and various color adjustments.

22 lines (21 loc) 1.05 kB
import { Color } from './color'; interface ColorWeight { color: Color | string; weight: number; } /** * Blends multiple colors together based on their specified weights, producing a new color. * Each color's weight determines its contribution to the resulting blend. * * @param {ColorWeight[]} colorWeights - An array of objects, each containing a `color` which is the object of Color class or string in a recognized color format and a `weight` number. * The weights determine the contribution of each color to the final blend. * * @returns {string} - The blended color in the same format as the first color in the array. * * @throws {Error} - Throws an error if any color is in an invalid format or if weights are invalid. * * Example usage: * blendMultipleColors([{ color: '#FF0000', weight: 1 }, { color: '#0000FF', weight: 2 }]); // returns a color string blended from red and blue with blue having twice the weight. */ declare const blendMultipleColors: (colorWeights: ColorWeight[]) => string; export { blendMultipleColors };