.. role:: clio-static
   :class: clio-flag clio-flag-static


#####
Color
#####

.. js:class:: Color

   An object representing an RGB Color. Values are specified in the 0-255 range.
   
   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~Color.constructor`
   
   .. rubric:: Properties
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:data:`~Color.b`
   * :js:data:`~Color.g`
   * :js:data:`~Color.r`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :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.toHexString`
   * :js:meth:`~Color.toJson`
   * :js:meth:`~static Color.black`
   * :js:meth:`~static Color.blue`
   * :js:meth:`~static Color.createFromFloat`
   * :js:meth:`~static Color.createFromFloatArray`
   * :js:meth:`~static Color.fromHexString`
   * :js:meth:`~static Color.fromJson`
   * :js:meth:`~static Color.green`
   * :js:meth:`~static Color.red`
   * :js:meth:`~static Color.white`
   * :js:meth:`~static Color.yellow`
   
   




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

.. js:method:: Color.constructor

   .. rst-class:: sig-pretty-signature
   
      | Color(**r**\ : *number*\ , **g**\ : *number*\ , **b**\ : *number*\ ): :js:class:`~Color`
   
   Creates a new color object. Values are specified in the 0-255 range.
   
   **Parameters**
   
      **r**\ : *number*
   
         red color component
   
   
      **g**\ : *number*
   
         green color component
   
   
      **b**\ : *number*
   
         blue color component
   
   
   
   **Returns**\ : :js:class:`~Color`
   





Properties
==========

.. js:data:: Color.b

   .. rst-class:: sig-pretty-signature
   
      | b: *number*
   



.. js:data:: Color.g

   .. rst-class:: sig-pretty-signature
   
      | g: *number*
   



.. js:data:: Color.r

   .. rst-class:: sig-pretty-signature
   
      | r: *number*
   





Methods
=======

.. js:method:: Color.assign

   .. rst-class:: sig-pretty-signature
   
      | assign(**color**\ : :js:class:`~Color`\ ): *this*
   
   Sets this color equal to another color
   
   **Parameters**
   
      **color**\ : :js:class:`~Color`
   
         the point whose values will be used to set this color
   
   
   
   **Returns**\ : *this*
   
      the color object
   
   



.. js:method:: Color.copy

   .. rst-class:: sig-pretty-signature
   
      | copy(): :js:class:`~Color`
   
   Creates a copy of this color
   
   **Returns**\ : :js:class:`~Color`
   
      Copy of this color
   
   



.. js:method:: Color.equals

   .. rst-class:: sig-pretty-signature
   
      | equals(**color**\ : :js:class:`~Color`\ ): *boolean*
   
   Compares this color with another color
   
   **Parameters**
   
      **color**\ : :js:class:`~Color`
   
         the color to compare with
   
   
   
   **Returns**\ : *boolean*
   
      True if the values of this color equal the other. False otherwise.
   
   



.. js:method:: Color.fromFloatArray

   .. rst-class:: sig-pretty-signature
   
      | fromFloatArray(**arr**\ : *number*\ []): *void*
   
   Sets this color from an array of normalized floating point values
   
   **Parameters**
   
      **arr**\ : *number*\ []
   
   
   **Returns**\ : *void*
   



.. js:method:: Color.getFloatArray

   .. rst-class:: sig-pretty-signature
   
      | getFloatArray(): [*number*\ , *number*\ , *number*\ ]
   
   Gets an array of floating point values representing this color. Values are clamped in the 0.0 - 1.0 range.
   
   **Returns**\ : [*number*\ , *number*\ , *number*\ ]
   
      array of floating point values for this color.
   
   



.. js:method:: Color.set

   .. rst-class:: sig-pretty-signature
   
      | set(**r**\ : *number*\ , **g**\ : *number*\ , **b**\ : *number*\ ): *void*
   
   Sets the color object. Values are specified in the 0-255 range.
   
   **Parameters**
   
      **r**\ : *number*
   
         red color component
   
   
      **g**\ : *number*
   
         green color component
   
   
      **b**\ : *number*
   
         blue color component
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Color.setFromFloat

   .. rst-class:: sig-pretty-signature
   
      | setFromFloat(**r**\ : *number*\ , **g**\ : *number*\ , **b**\ : *number*\ ): *void*
   
   Sets the color object from floating point values. Values are specified in the 0.0-1.0 range.
   
   **Parameters**
   
      **r**\ : *number*
   
         red color component
   
   
      **g**\ : *number*
   
         green color component
   
   
      **b**\ : *number*
   
         blue color component
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Color.toFloatArray

   .. rst-class:: sig-pretty-signature
   
      | toFloatArray(**arr**\ : *number*\ []?): *number*\ []
   
   Populates an array with floating point values for this color. Values are clamped in the 0.0 - 1.0 range.
   
   **Parameters**
   
      **arr**\ : *number*\ [] = ...
   
         array whose first three elements will be populated with the r,g, and b values of this color respectively.
   
   
   
   **Returns**\ : *number*\ []
   



.. js:method:: Color.toHexString

   .. rst-class:: sig-pretty-signature
   
      | toHexString(): *string*
   
   Converts the color to a hexadecimal string.
   
   **Returns**\ : *string*
   
      Hexadecimal string representation of the color.
   
   



.. js:method:: Color.toJson

   .. rst-class:: sig-pretty-signature
   
      | toJson(): :js:class:`~IColor`
   
   Creates an object ready for JSON serialization.
   
   **Returns**\ : :js:class:`~IColor`
   
      The prepared object.
   
   



.. js:method:: static Color.black

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | black(): :js:class:`~Color`
   
   Creates a new color object initialized to black.
   
   **Returns**\ : :js:class:`~Color`
   
      new color object
   
   



.. js:method:: static Color.blue

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | blue(): :js:class:`~Color`
   
   Creates a new color object initialized to blue.
   
   **Returns**\ : :js:class:`~Color`
   
      new color object
   
   



.. js:method:: static Color.createFromFloat

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | createFromFloat(**r**\ : *number*\ , **g**\ : *number*\ , **b**\ : *number*\ ): :js:class:`~Color`
   
   Creates a color object from floating point values. Values are specified in the 0.0-1.0 range.
   
   **Parameters**
   
      **r**\ : *number*
   
         red color component
   
   
      **g**\ : *number*
   
         green color component
   
   
      **b**\ : *number*
   
         blue color component
   
   
   
   **Returns**\ : :js:class:`~Color`
   
      new color object
   
   



.. js:method:: static Color.createFromFloatArray

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | createFromFloatArray(**values**\ : *number*\ []): :js:class:`~Color`
   
   Creates a color object from an array of floating point values. Values are specified in the 0.0-1.0 range.
   
   **Parameters**
   
      **values**\ : *number*\ []
   
   
   **Returns**\ : :js:class:`~Color`
   



.. js:method:: static Color.fromHexString

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | fromHexString(**hexString**\ : *string*\ ): :js:class:`~Color`
   
   Creates a color object from a hexadecimal string.
   
   **Parameters**
   
      **hexString**\ : *string*
   
         Hexadecimal string representation of the color.
   
   
   
   **Returns**\ : :js:class:`~Color`
   
      new color object
   
   



.. js:method:: static Color.fromJson

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | fromJson(**objData**\ : *unknown*\ ): :js:class:`~Color`
   
   Creates a new [[Color]] from an object given by [[toJson]].
   
   **Parameters**
   
      **objData**\ : *unknown*
   
         An object given by [[toJson]].
   
   
   
   **Returns**\ : :js:class:`~Color`
   
      The prepared object.
   
   



.. js:method:: static Color.green

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | green(): :js:class:`~Color`
   
   Creates a new color object initialized to green.
   
   **Returns**\ : :js:class:`~Color`
   
      new color object
   
   



.. js:method:: static Color.red

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | red(): :js:class:`~Color`
   
   Creates a new color object initialized to red.
   
   **Returns**\ : :js:class:`~Color`
   
      new color object
   
   



.. js:method:: static Color.white

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | white(): :js:class:`~Color`
   
   Creates a new color object initialized to white.
   
   **Returns**\ : :js:class:`~Color`
   
      new color object
   
   



.. js:method:: static Color.yellow

   .. rst-class:: clio-flags
   
      :clio-static:`static`
   
   .. rst-class:: sig-pretty-signature
   
      | yellow(): :js:class:`~Color`
   
   Creates a new color object initialized to yellow.
   
   **Returns**\ : :js:class:`~Color`
   
      new color object
   
   





