Color

All properties and functions that expect color values accept instances of the different color classes such as RgbColor, HsbColor and GrayColor, and also accept named colors and hex values as strings which are then converted to instances of RgbColor internally.

Example — Named color values:

Run
// Pass a color name to the fillColor property, which is internally
1
2
3
4
5
6
7
 
// Create a circle shaped path at {x: 80, y: 50}
// with a radius of 30.
var circle = new Path.Circle(new Point(80, 50), 30);
 
// Pass a color name to the fillColor property, which is internally
// converted to an RgbColor.
circle.fillColor = 'green';

Example — Hex color values:

Run
// Pass a hex string to the fillColor property, which is internally
1
2
3
4
5
6
7
 
// Create a circle shaped path at {x: 80, y: 50}
// with a radius of 30.
var circle = new Path.Circle(new Point(80, 50), 30);
 
// Pass a hex string to the fillColor property, which is internally
// converted to an RgbColor.
circle.fillColor = '#ff0000';

Operators

Properties

RGB Components

Gray Components

HSB Components

HSL Components

Methods

String Representations