5.20231.904
5.20231.904

Color

The Color class parses colors specified as CSS strings and exposes their red, green, blue, and alpha channels as read-write properties.

It also provides fromHsb and fromHsl methods for creating colors using the HSB and HSL color models instead of RGB, as well as getHsb and getHsl methods for retrieving the color components using those color models.

Interpolating colors

The Color class also has an interpolate method that creates colors by interpolating between two colors using the HSL model. This method is especially useful for creating color animations with the animate method.

Example
import * as wijmo from '@grapecity/wijmo';

const color1 = new wijmo.Color('#c15dc1');
const color2 = new wijmo.Color('#0070c0');

// determines how close the interpolation should be to the second color
const percentage = .5; // value between 0-1

let interpolatedColor = new wijmo.Color.interpolate(color1, color2, percentage);