Top

namespace anychart.color Improve this Doc

Color utilities namespace.

Functions Overview

bipolarHueProgression()Multiple bipolar hue progression.
blend()Blend two colors together, using the specified factor to indicate the weight given to the first color.
blendedHueProgression()Multiple blended hue progression.
darken()Makes color darker by a factor.
lighten()Makes color lighter by a factor.
singleHueProgression()Single-hue progressions.

Functions Description

bipolarHueProgression

Multiple bipolar hue progression.

Params:

Name Type Default Description
color1 string
"blue"
Color in rgb, named or hex string representation like "rgb(255, 0, 0)", "red" or "#ff0000" accordingly.
color2 string
"red"
Color in rgb, named or hex string representation like "rgb(255, 0, 0)", "red" or "#ff0000" accordingly.
count number
7
Count of progression colors.

Returns:

Array.<string> - Multiple bipolar hue progression. Array of colors.

Try it:

blend

Blend two colors together, using the specified factor to indicate the weight given to the first color.

Params:

Name Type Description
rgb1 Array.<number> The first color represented as RGB array of 3 numbers.
rgb2 Array.<number> The second color represented as RGB array of 3 numbers.
factor number The weight of the first color over the second one rgb2. Values should be in the [0, 1] range. If set to a value less than 0, factor will be set to 0. If greater than 1, factor will be set to 1.

Try it:

blendedHueProgression

Multiple blended hue progression.

Params:

Name Type Default Description
color1 string
"#ffff00"
Color in rgb, named or hex string representation like "rgb(255, 0, 0)", "red" or "#ff0000" accordingly.
color2 string
"#a52a2a"
Color in rgb, named or hex string representation like "rgb(255, 0, 0)", "red" or "#ff0000" accordingly.
count number
7
Count of progression colors.

Returns:

Array.<string> - Multiple blended hue progression. Array of colors.

Try it:

darken

Makes color darker by a factor.

Params:

Name Type Default Description
fillOrStroke anychart.graphics.vector.Fill | anychart.graphics.vector.Stroke
Fill or stroke to be darkened.
factor number
0.3
Black color blending factor.

Returns:

string anychart.graphics.vector.Fill anychart.graphics.vector.Stroke - Hex representation of the darkened color, or Color if color can't be darkened.

Try it:

lighten

Makes color lighter by a factor.

Params:

Name Type Default Description
fillOrStroke anychart.graphics.vector.Fill | anychart.graphics.vector.Stroke
Fill or stroke to be lightened.
factor number
0.3
White color blending factor.

Returns:

string anychart.graphics.vector.Fill anychart.graphics.vector.Stroke - Hex representation of the lightened color, or Color if color can not be lighten.

Try it:

singleHueProgression

Single-hue progressions.

Params:

Name Type Default Description
color string
"black"
Color in rgb, named or hex string representation like "rgb(255, 0, 0)", "red" or "#ff0000" accordingly.
count number
7
Count of progression colors.
startOrTargetLightness number
0.95
Source lightness. Number in [0, 1]. 1 - very light (white), 0 - vere dark (black). If opt_startOrTargetLightness and opt_endLightness don't defined, then lightness progression starts from 0.95 and ends to lightness of passed color.
endLightness number
from passed color
Target lightness. Number in [0, 1]. 1 - very light (white), 0 - vere dark (black).

Returns:

Array.<string> - Single hue progression. Array of colors.

Try it: