Color

class Communicator.Color()

An object representing an RGB Color. Values are specified in the 0-255 range.

Constructors

Properties


Constructors

constructor

Communicator.Color.constructor(r, g, b)

Creates a new color object. Values are specified in the 0-255 range.

Arguments
  • r (number()) –

  • g (number()) –

  • b (number()) –

Return type

Communicator.Color

Properties

Communicator.Color.b
Communicator.Color.g
Communicator.Color.r

Methods

assign

Communicator.Color.assign(color)

Sets this color equal to another color

Arguments
Return type

Communicator.Color

Returns

the color object

copy

Communicator.Color.copy()

Creates a copy of this color

Return type

Communicator.Color

Returns

Copy of this color

equals

Communicator.Color.equals(color)

Compares this color with another color

Arguments
Return type

boolean

Returns

True if the values of this color equal the other. False otherwise.

forJson

Communicator.Color.forJson()

Note

forJson is deprecated: Use toJson instead.

Return type

Object

fromFloatArray

Communicator.Color.fromFloatArray(arr)

Sets this color from an array of normalized floating point values

Arguments
  • arr ([number]()) –

Return type

void

getFloatArray

Communicator.Color.getFloatArray()

Gets an array of floating point values representing this color. Values are clamped in the 0.0 - 1.0 range.

Return type

(number, number, number)

Returns

array of floating point values for this color.

set

Communicator.Color.set(r, g, b)

Sets the color object. Values are specified in the 0-255 range.

Arguments
  • r (number()) – red color component

  • g (number()) – green color component

  • b (number()) – blue color component

Return type

void

setFromFloat

Communicator.Color.setFromFloat(r, g, b)

Sets the color object from floating point values. Values are specified in the 0.0-1.0 range.

Arguments
  • r (number()) – red color component

  • g (number()) – green color component

  • b (number()) – blue color component

Return type

void

toFloatArray

Communicator.Color.toFloatArray(arr)

Populates an array with floating point values for this color. Values are clamped in the 0.0 - 1.0 range.

Arguments
  • arr ([number]()) – array whose first three elements will be populated with the r,g, and b values of this color respectively.

Return type

void

toJson

Communicator.Color.toJson()

Creates an object ready for JSON serialization.

Return type

Object

Returns

The prepared object.

black

Communicator.Color.black()

Creates a new color object initialized to black.

Return type

Communicator.Color

Returns

new color object

blue

Communicator.Color.blue()

Creates a new color object initialized to blue.

Return type

Communicator.Color

Returns

new color object

createFromFloat

Communicator.Color.createFromFloat(r, g, b)

Creates a color object from floating point values. Values are specified in the 0.0-1.0 range.

Arguments
  • r (number()) – red color component

  • g (number()) – green color component

  • b (number()) – blue color component

Return type

Communicator.Color

Returns

new color object

createFromFloatArray

Communicator.Color.createFromFloatArray(values)

Creates a color object from an array of floating point values. Values are specified in the 0.0-1.0 range.

Arguments
  • values ([number]()) –

Return type

Communicator.Color

fromJson

Communicator.Color.fromJson(objData)

Creates a new Color from an object given by toJson

Arguments
  • objData (any()) – An object given by toJson

Return type

Communicator.Color

Returns

The prepared object.

green

Communicator.Color.green()

Creates a new color object initialized to green.

Return type

Communicator.Color

Returns

new color object

red

Communicator.Color.red()

Creates a new color object initialized to red.

Return type

Communicator.Color

Returns

new color object

white

Communicator.Color.white()

Creates a new color object initialized to white.

Return type

Communicator.Color

Returns

new color object

yellow

Communicator.Color.yellow()

Creates a new color object initialized to yellow.

Return type

Communicator.Color

Returns

new color object