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


#####
Color
#####

.. js:class:: wv.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:`~wv.Color.constructor`
   
   .. rubric:: Properties
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:data:`~wv.Color.b`
   * :js:data:`~wv.Color.g`
   * :js:data:`~wv.Color.r`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~static wv.Color.black`
   * :js:meth:`~static wv.Color.blue`
   * :js:meth:`~static wv.Color.createFromFloat`
   * :js:meth:`~static wv.Color.createFromFloatArray`
   * :js:meth:`~static wv.Color.fromHexString`
   * :js:meth:`~static wv.Color.fromJson`
   * :js:meth:`~static wv.Color.green`
   * :js:meth:`~static wv.Color.red`
   * :js:meth:`~static wv.Color.white`
   * :js:meth:`~static wv.Color.yellow`
   * :js:meth:`~wv.Color.assign`
   * :js:meth:`~wv.Color.copy`
   * :js:meth:`~wv.Color.equals`
   * :js:meth:`~wv.Color.fromFloatArray`
   * :js:meth:`~wv.Color.getFloatArray`
   * :js:meth:`~wv.Color.set`
   * :js:meth:`~wv.Color.setFromFloat`
   * :js:meth:`~wv.Color.toFloatArray`
   * :js:meth:`~wv.Color.toHexString`
   * :js:meth:`~wv.Color.toJson`
   
   



.. rst-class:: kind-group kind-constructors

.. rubric:: Constructors
   :class: kind-group-title


.. js:method:: wv.Color.constructor

      .. rst-class:: sig-pretty-signature
      
         | Color(**r**\ : *number*\ , **g**\ : *number*\ , **b**\ : *number*\ ): :js:class:`Color <wv.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 <wv.Color>`
      



.. rst-class:: kind-group kind-properties

.. rubric:: Properties
   :class: kind-group-title


.. js:data:: wv.Color.b

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



.. js:data:: wv.Color.g

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



.. js:data:: wv.Color.r

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



.. rst-class:: kind-group kind-methods

.. rubric:: Methods
   :class: kind-group-title


.. js:method:: static wv.Color.black

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



.. js:method:: static wv.Color.blue

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



.. js:method:: static wv.Color.createFromFloat

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | createFromFloat(**r**\ : *number*\ , **g**\ : *number*\ , **b**\ : *number*\ ): :js:class:`Color <wv.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 <wv.Color>`
      
      
         new color object
      
      



.. js:method:: static wv.Color.createFromFloatArray

      .. rst-class:: clio-flags
      
         :clio-static:`static`
      
      .. rst-class:: sig-pretty-signature
      
         | createFromFloatArray(**values**\ : *number*\ []): :js:class:`Color <wv.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 <wv.Color>`
      



.. js:method:: static wv.Color.fromHexString

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



.. js:method:: static wv.Color.fromJson

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



.. js:method:: static wv.Color.green

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



.. js:method:: static wv.Color.red

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



.. js:method:: static wv.Color.white

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



.. js:method:: static wv.Color.yellow

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



.. js:method:: wv.Color.assign

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



.. js:method:: wv.Color.copy

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



.. js:method:: wv.Color.equals

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



.. js:method:: wv.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*\ []
      
      
            the array to assign from
      
      
      
      **Returns**\ : *void*
      



.. js:method:: wv.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:: wv.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:: wv.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:: wv.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:: wv.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:: wv.Color.toJson

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




