AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.5.0 version of this document. Switch to the 8.4.0 version to see the up to date information.

namespace anychart.color Improve this Doc

Color utilities namespace.

Functions Overview

blend()Blend two colors together, using the specified factor to indicate the weight given to the first color.
darken()Makes color darker by a factor.
lighten()Makes color lighter by a factor.

Functions Description

blend

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

Params:

NameTypeDescription
rgb1goog.color.RgbThe first color represented as RGB array of 3 numbers.
rgb2goog.color.RgbThe second color represented as RGB array of 3 numbers.
factornumberThe 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.

Returns:

goog.color.Rgb - Combined color represented as RGB array.

darken

Makes color darker by a factor.

Params:

NameTypeDefaultDescription
fillOrStrokeanychart.graphics.vector.Fill | anychart.graphics.vector.Stroke
Fill or stroke to be darkened.
factornumber
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.

lighten

Makes color lighter by a factor.

Params:

NameTypeDefaultDescription
fillOrStrokeanychart.graphics.vector.Fill | anychart.graphics.vector.Stroke
Fill or stroke to be lightened.
factornumber
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.