.. role:: ts-api-decorator

#####
Color
#####

.. container:: ts-api-section

   .. js:class:: Color

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



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~Color.constructor`



.. container:: api-index-section

   .. rubric:: Properties

   .. rst-class:: api-index-list-item api-kind-property api-parent-kind-class

   * :js:attr:`~Color.b`
   * :js:attr:`~Color.g`
   * :js:attr:`~Color.r`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~Color.assign`
   * :js:meth:`~Color.copy`
   * :js:meth:`~Color.equals`
   * :js:meth:`~Color.fromFloatArray`
   * :js:meth:`~Color.getFloatArray`
   * :js:meth:`~Color.set`
   * :js:meth:`~Color.setFromFloat`
   * :js:meth:`~Color.toFloatArray`
   * :js:meth:`~Color.toJson`
   * :js:meth:`~Color.black`
   * :js:meth:`~Color.blue`
   * :js:meth:`~Color.createFromFloat`
   * :js:meth:`~Color.createFromFloatArray`
   * :js:meth:`~Color.fromJson`
   * :js:meth:`~Color.green`
   * :js:meth:`~Color.red`
   * :js:meth:`~Color.white`
   * :js:meth:`~Color.yellow`





------------

Constructors
============

.. container:: ts-api-section

   .. js:function:: Color.constructor( r, g, b)

      :param r: red color component
      :type r: number
      :param g: green color component
      :type g: number
      :param b: blue color component
      :type b: number


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


      :rtype: Color



Properties
==========

.. container:: ts-api-section

   .. js:attribute:: Color.b

      :type: number





.. container:: ts-api-section

   .. js:attribute:: Color.g

      :type: number





.. container:: ts-api-section

   .. js:attribute:: Color.r

      :type: number





Methods
=======

.. rst-class:: ts-api-section

assign
------

.. js:method:: Color.assign( color)

   :param color: the point whose values will be used to set this color
   :type color: Color


   Sets this color equal to another color

   :returns: the color object


   :rtype: this

.. rst-class:: ts-api-section

copy
----

.. js:method:: Color.copy()



   Creates a copy of this color

   :returns: Copy of this color


   :rtype: Color

.. rst-class:: ts-api-section

equals
------

.. js:method:: Color.equals( color)

   :param color: the color to compare with
   :type color: Color


   Compares this color with another color

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


   :rtype: boolean

.. rst-class:: ts-api-section

fromFloatArray
--------------

.. js:method:: Color.fromFloatArray( arr)

   :param arr: None
   :type arr: [number]


   Sets this color from an array of normalized floating point values


   :rtype: void

.. rst-class:: ts-api-section

getFloatArray
-------------

.. js:method:: Color.getFloatArray()



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

   :returns: array of floating point values for this color.


   :rtype: (number, number, number)

.. rst-class:: ts-api-section

set
---

.. js:method:: Color.set( r, g, b)

   :param r: red color component
   :type r: number
   :param g: green color component
   :type g: number
   :param b: blue color component
   :type b: number


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


   :rtype: void

.. rst-class:: ts-api-section

setFromFloat
------------

.. js:method:: Color.setFromFloat( r, g, b)

   :param r: red color component
   :type r: number
   :param g: green color component
   :type g: number
   :param b: blue color component
   :type b: number


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


   :rtype: void

.. rst-class:: ts-api-section

toFloatArray
------------

.. js:method:: Color.toFloatArray( arr)

   :param arr: array whose first three elements will be populated with the r,g, and b values of this color respectively.
   :type arr: [number]


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


   :rtype: [number]

.. rst-class:: ts-api-section

toJson
------

.. js:method:: Color.toJson()



   Creates an object ready for JSON serialization.

   :returns: The prepared object.


   :rtype: IColor

.. rst-class:: ts-api-section

:ts-api-decorator:`static` black
--------------------------------

.. js:method:: Color.black()



   Creates a new color object initialized to black.

   :returns: new color object


   :rtype: Color

.. rst-class:: ts-api-section

:ts-api-decorator:`static` blue
-------------------------------

.. js:method:: Color.blue()



   Creates a new color object initialized to blue.

   :returns: new color object


   :rtype: Color

.. rst-class:: ts-api-section

:ts-api-decorator:`static` createFromFloat
------------------------------------------

.. js:method:: Color.createFromFloat( r, g, b)

   :param r: red color component
   :type r: number
   :param g: green color component
   :type g: number
   :param b: blue color component
   :type b: number


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

   :returns: new color object


   :rtype: Color

.. rst-class:: ts-api-section

:ts-api-decorator:`static` createFromFloatArray
-----------------------------------------------

.. js:method:: Color.createFromFloatArray( values)

   :param values: None
   :type values: [number]


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


   :rtype: Color

.. rst-class:: ts-api-section

:ts-api-decorator:`static` fromJson
-----------------------------------

.. js:method:: Color.fromJson( objData)

   :param objData: An object given by [[toJson]].
   :type objData: unknown


   Creates a new [[Color]] from an object given by [[toJson]].

   :returns: The prepared object.


   :rtype: Color

.. rst-class:: ts-api-section

:ts-api-decorator:`static` green
--------------------------------

.. js:method:: Color.green()



   Creates a new color object initialized to green.

   :returns: new color object


   :rtype: Color

.. rst-class:: ts-api-section

:ts-api-decorator:`static` red
------------------------------

.. js:method:: Color.red()



   Creates a new color object initialized to red.

   :returns: new color object


   :rtype: Color

.. rst-class:: ts-api-section

:ts-api-decorator:`static` white
--------------------------------

.. js:method:: Color.white()



   Creates a new color object initialized to white.

   :returns: new color object


   :rtype: Color

.. rst-class:: ts-api-section

:ts-api-decorator:`static` yellow
---------------------------------

.. js:method:: Color.yellow()



   Creates a new color object initialized to yellow.

   :returns: new color object


   :rtype: Color

