namespace anychart.color Improve this Doc
Color utility 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. |
setThickness() | Sets opacity to stroke. |
singleHueProgression() | Single-hue progression. |
Functions Description
bipolarHueProgression
Multiple bipolar hue progression.
Detailed description
For bipolar data, we recommend color schemes in which two hues diverge away from a common light/white hue.
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, the factor will be set to 0. If greater than 1, the factor will be set to 1. |
Returns:
anychart.graphics.vector.SolidFill - Combined color represented as anychart.graphics.vector.SolidFill.Try it:
blendedHueProgression
Multiple blended hue progression.
Detailed description
Blended hue progressions uses related hues to blend together the two end point hues.
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 cannot be lightened.Try it:
setThickness
Sets opacity to stroke.
Params:
Name | Type | Description |
---|---|---|
stroke | anychart.graphics.vector.Stroke | Stroke. |
thickness | number | Thickness to set. |
opacity | number | Opacity to set. |
Returns:
anychart.graphics.vector.Stroke - Normalized color with new thickness.Try it:
singleHueProgression
Single-hue progression.
Detailed description
Single-hue progressions fade from a dark shade of the chosen color to a very light or white shade of relatively
the same hue.
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: