Skip to main content

Class: Color

Common.Color()

Represents digital ink color in RGBA format

Constructor

new Color()

Properties:
NameTypeAttributesDescription
redintRed component, value between 0 and 255
greenintGreen component, value between 0 and 255
blueintBlue component, value between 0 and 255
alphafloat<optional>Alpha (Opacity) component, value between 0 and 1

Members

(static) BLACK :Common.Color

Represents color Black

Type:

(static) BLUE :Common.Color

Represents color Blue

Type:

(static) GREEN :Common.Color

Represents color Green

Type:

(static) RED :Common.Color

Represents color Red

Type:

(static) TRANSPERENT :Common.Color

Represents transperent color

Type:

(static) WHITE :Common.Color

Represents color White

Type:

Methods

equals(color) → {boolean}

Checks colors equation

Parameters:
NameTypeDescription
colorCommon.Color
Returns:

is the same color represented

Type

boolean

toArray() → {Array.<byte>}

Creates a RGBA array from color

Returns:

rgba array

Type

Array.<byte>

toHSLA() → Common.Color.HSLA

Returns:

hsla color

Type

Common.Color.HSLA

toJSON() → {JSON}

Returns:

Matrix data

Type

JSON

toRGB() → Common.Color

Removes opacity

Returns:

Color without alpha

Type

Common.Color

toRGBA(alpha) → Common.Color

Creates semi-transperant color

Parameters:
NameTypeDescription
alphafloat
Returns:

Color with alpha

Type

Common.Color

toString() → {string}

Creates a rgba string from color

Returns:

css color

Type

string

(static) fromColor(color) → {boolean}

Creates Color instance form color data

Parameters:
NameTypeDescription
colorColor|JSON|Array|stringWhere string coluld be rgba, rgb or hex string
Returns:

argument is color

Type

boolean

(static) fromHSLA(hue, saturation, lightness, alpha) → Common.Color

Creates a color from HSLA

Parameters:
NameTypeDefaultDescription
huefloat0Degrees between 0-359
saturationfloat0% between 0-100
lightnessfloat0% between 0-100
alphafloatBetween 0-1
Returns:

color

Type

Common.Color

(static) isColor(color) → {boolean}

Checks is argument defines Color

Parameters:
NameTypeDescription
colorColor|JSON
Returns:

argument is color

Type

boolean

Type Definitions

HSLA

Defines HSLA color

Properties:
NameTypeDescription
huefloatHue as degrees, value between 0-359
saturationfloatSaturation as percent, value between 0-100
lightnessfloatLightness as percent, value between 0-100
alphafloatAlpha (Opacity) component, value between 0-1

RGB

Defines RGB color

Properties:
NameTypeDescription
redbyteRed component, value between 0 and 255
greenbyteGreen component, value between 0 and 255
bluebyteBlue component, value between 0 and 255

Home