|
@@ -6,15 +6,16 @@ Color - Represents a color
|
|
.. class:: Color(hex)
|
|
.. class:: Color(hex)
|
|
|
|
|
|
Represents a color
|
|
Represents a color
|
|
-
|
|
|
|
|
|
+
|
|
:param integer hex: Hex value to intialize the color
|
|
:param integer hex: Hex value to intialize the color
|
|
|
|
|
|
|
|
+
|
|
.. rubric:: Attributes
|
|
.. rubric:: Attributes
|
|
|
|
|
|
.. attribute:: Color.r
|
|
.. attribute:: Color.r
|
|
|
|
|
|
Red channel (float between 0 and 1)
|
|
Red channel (float between 0 and 1)
|
|
-
|
|
|
|
|
|
+
|
|
.. attribute:: Color.g
|
|
.. attribute:: Color.g
|
|
|
|
|
|
Green channel (float between 0 and 1)
|
|
Green channel (float between 0 and 1)
|
|
@@ -23,6 +24,7 @@ Color - Represents a color
|
|
|
|
|
|
Blue channel (float between 0 and 1)
|
|
Blue channel (float between 0 and 1)
|
|
|
|
|
|
|
|
+
|
|
.. rubric:: Methods
|
|
.. rubric:: Methods
|
|
|
|
|
|
.. function:: Color.convertGammaToLinear()
|
|
.. function:: Color.convertGammaToLinear()
|
|
@@ -36,29 +38,29 @@ Color - Represents a color
|
|
.. function:: Color.copy(color)
|
|
.. function:: Color.copy(color)
|
|
|
|
|
|
Copies the given color into this color
|
|
Copies the given color into this color
|
|
-
|
|
|
|
|
|
+
|
|
:param Color color: Color to copy
|
|
:param Color color: Color to copy
|
|
-
|
|
|
|
|
|
+
|
|
.. function:: Color.copyGammaToLinear(color)
|
|
.. function:: Color.copyGammaToLinear(color)
|
|
|
|
|
|
Creates a gamma color from a linear color
|
|
Creates a gamma color from a linear color
|
|
-
|
|
|
|
|
|
+
|
|
:param Color color: Color to copy
|
|
:param Color color: Color to copy
|
|
:returns: Linear color
|
|
:returns: Linear color
|
|
:rtype: Color
|
|
:rtype: Color
|
|
-
|
|
|
|
|
|
+
|
|
.. function:: Color.copyLinearToGamma(color)
|
|
.. function:: Color.copyLinearToGamma(color)
|
|
|
|
|
|
Creates a linear color from a gamma color
|
|
Creates a linear color from a gamma color
|
|
-
|
|
|
|
|
|
+
|
|
:param Color color: Color to copy
|
|
:param Color color: Color to copy
|
|
:returns: Gamma color
|
|
:returns: Gamma color
|
|
:rtype: Color
|
|
:rtype: Color
|
|
-
|
|
|
|
|
|
+
|
|
.. function:: Color.setRGB(r, g, b)
|
|
.. function:: Color.setRGB(r, g, b)
|
|
|
|
|
|
Sets the RGB value of this color
|
|
Sets the RGB value of this color
|
|
-
|
|
|
|
|
|
+
|
|
:param float r: Red channel value (between 0 and 1)
|
|
:param float r: Red channel value (between 0 and 1)
|
|
:param float g: Green channel value (between 0 and 1)
|
|
:param float g: Green channel value (between 0 and 1)
|
|
:param float b: Blue channel value (between 0 and 1)
|
|
:param float b: Blue channel value (between 0 and 1)
|
|
@@ -67,40 +69,41 @@ Color - Represents a color
|
|
|
|
|
|
Sets the HSV value of this color. Based on MochiKit implementation by
|
|
Sets the HSV value of this color. Based on MochiKit implementation by
|
|
Bob Ippolito.
|
|
Bob Ippolito.
|
|
-
|
|
|
|
|
|
+
|
|
:param float h: Hue channel (between 0 and 1)
|
|
:param float h: Hue channel (between 0 and 1)
|
|
:param float s: Saturation channel (between 0 and 1)
|
|
:param float s: Saturation channel (between 0 and 1)
|
|
:param float v: Value channel (between 0 and 1)
|
|
:param float v: Value channel (between 0 and 1)
|
|
-
|
|
|
|
|
|
+
|
|
.. function:: Color.setHex(hex)
|
|
.. function:: Color.setHex(hex)
|
|
|
|
|
|
Sets the value of this color from a hex value
|
|
Sets the value of this color from a hex value
|
|
-
|
|
|
|
|
|
+
|
|
:param integer hex: Value of the color in hex
|
|
:param integer hex: Value of the color in hex
|
|
|
|
|
|
.. function:: Color.getHex()
|
|
.. function:: Color.getHex()
|
|
|
|
|
|
Gets the value of this color in hex
|
|
Gets the value of this color in hex
|
|
-
|
|
|
|
|
|
+
|
|
:returns: The color value in hex
|
|
:returns: The color value in hex
|
|
:rtype: integer
|
|
:rtype: integer
|
|
-
|
|
|
|
|
|
+
|
|
.. function:: Color.getContextStyle()
|
|
.. function:: Color.getContextStyle()
|
|
|
|
|
|
Returns the value of this color in CSS context style.
|
|
Returns the value of this color in CSS context style.
|
|
-
|
|
|
|
|
|
+
|
|
Example: ``rgb(r,g,b)``
|
|
Example: ``rgb(r,g,b)``
|
|
-
|
|
|
|
|
|
+
|
|
:returns: A CSS-formatted color value
|
|
:returns: A CSS-formatted color value
|
|
:rtype: string
|
|
:rtype: string
|
|
-
|
|
|
|
|
|
+
|
|
.. function:: Color.clone()
|
|
.. function:: Color.clone()
|
|
|
|
|
|
Clones this color
|
|
Clones this color
|
|
-
|
|
|
|
|
|
+
|
|
:returns: New instance identical to this color
|
|
:returns: New instance identical to this color
|
|
:rtype: Color
|
|
:rtype: Color
|
|
|
|
|
|
|
|
+
|
|
.. rubric:: Example
|
|
.. rubric:: Example
|
|
|
|
|
|
::
|
|
::
|