Color in RGBA format with some support for ARGB format.
</brief_description>
<description>
A color is represented as red, green and blue (r,g,b) components. Additionally, "a" represents the alpha component, often used for transparency. Values are in floating point and usually range from 0 to 1. Some methods (such as set_modulate(color)) may accept values > 1.
</description>
<tutorials>
</tutorials>
<demos>
</demos>
<methods>
<methodname="Color">
<returntype="Color">
</return>
<argumentindex="0"name="r"type="float">
</argument>
<argumentindex="1"name="g"type="float">
</argument>
<argumentindex="2"name="b"type="float">
</argument>
<argumentindex="3"name="a"type="float">
</argument>
<description>
Constructs a color from an RGBA profile using values between 0 and 1 (float).
[codeblock]
var c = Color(0.2, 1.0, .7, .8) # a color of an RGBA(51, 255, 178, 204)
[/codeblock]
</description>
</method>
<methodname="Color">
<returntype="Color">
</return>
<argumentindex="0"name="r"type="float">
</argument>
<argumentindex="1"name="g"type="float">
</argument>
<argumentindex="2"name="b"type="float">
</argument>
<description>
Constructs a color from an RGB profile using values between 0 and 1 (float). Alpha will always be 1.
[codeblock]
var c = Color(0.2, 1.0, .7) # a color of an RGBA(51, 255, 178, 255)
[/codeblock]
</description>
</method>
<methodname="Color">
<returntype="Color">
</return>
<argumentindex="0"name="from"type="int">
</argument>
<description>
Constructs a color from a 32-bit integer (each byte represents a component of the RGBA profile).
[codeblock]
var c = Color(274) # a color of an RGBA(0, 0, 1, 18)
[/codeblock]
</description>
</method>
<methodname="Color">
<returntype="Color">
</return>
<argumentindex="0"name="from"type="String">
</argument>
<description>
Constructs a color from an HTML hexadecimal color string in ARGB or RGB format.
The following string formats are supported:
[code]"#ff00ff00"[/code] - ARGB format with '#'
[code]"ff00ff00"[/code] - ARGB format
[code]"#ff00ff"[/code] - RGB format with '#'
[code]"ff00ff"[/code] - RGB format
[codeblock]
# The following code creates the same color of an RGBA(178, 217, 10, 255)
var c1 = Color("#ffb2d90a") # ARGB format with '#'
var c2 = Color("ffb2d90a") # ARGB format
var c3 = Color("#b2d90a") # RGB format with '#'
var c4 = Color("b2d90a") # RGB format
[/codeblock]
</description>
</method>
<methodname="blend">
<returntype="Color">
</return>
<argumentindex="0"name="over"type="Color">
</argument>
<description>
Returns a new color resulting from blending this color over another color. If the color is opaque, the result would also be opaque. The other color could then take a range of values with different alpha values.
[codeblock]
var bg = Color(0.0, 1.0, 0.0, 0.5) # Green with alpha of 50%
var fg = Color(1.0, 0.0, 0.0, .5) # Red with alpha of 50%
var blendedColor = bg.blend(fg) # Brown with alpha of 75%
[/codeblock]
</description>
</method>
<methodname="contrasted">
<returntype="Color">
</return>
<description>
Returns the most contrasting color.
[codeblock]
var c = Color(.3, .4, .9)
var contrastedColor = c.contrasted() # a color of an RGBA(204, 229, 102, 255)
[/codeblock]
</description>
</method>
<methodname="gray">
<returntype="float">
</return>
<description>
Returns the color's grayscale.
The gray is calculated by (r + g + b) / 3.
[codeblock]
var c = Color(0.2, 0.45, 0.82)
var gray = c.gray() # a value of 0.466667
[/codeblock]
</description>
</method>
<methodname="inverted">
<returntype="Color">
</return>
<description>
Returns the inverted color (1-r, 1-g, 1-b, 1-a).
[codeblock]
var c = Color(.3, .4, .9)
var invertedColor = c.inverted() # a color of an RGBA(178, 153, 26, 255)
[/codeblock]
</description>
</method>
<methodname="linear_interpolate">
<returntype="Color">
</return>
<argumentindex="0"name="b"type="Color">
</argument>
<argumentindex="1"name="t"type="float">
</argument>
<description>
Returns the color of the linear interpolation with another color. The value t is between 0 and 1 (float).
[codeblock]
var c1 = Color(1.0, 0.0, 0.0)
var c2 = Color(0.0, 1.0, 0.0)
var li_c = c1.linear_interpolate(c2, 0.5) # a color of an RGBA(128, 128, 0, 255)
[/codeblock]
</description>
</method>
<methodname="to_argb32">
<returntype="int">
</return>
<description>
Returns the color's 32-bit integer in ARGB format (each byte represents a component of the ARGB profile). More compatible with DirectX.