Color Structure |
Namespace: Godot
[SerializableAttribute] public struct Color : IEquatable<Color>
The Color type exposes the following members.
Name | Description | |
---|---|---|
Color(Int32) |
Constructs a color from a 32-bit integer in RGBA format
(each byte represents a color channel).
| |
Color(Int64) |
Constructs a color from a 64-bit integer in RGBA format
(each word represents a color channel).
| |
Color(String) |
Constructs a color from the HTML hexadecimal color string in RGBA format.
| |
Color(Color, Single) |
Constructs a color from an existing color and an alpha value.
| |
Color(Single, Single, Single, Single) |
Constructs a color from RGBA values, typically on the range of 0 to 1.
|
Name | Description | |
---|---|---|
a8 |
Wrapper for a that uses the range 0 to 255 instead of 0 to 1.
| |
b8 |
Wrapper for b that uses the range 0 to 255 instead of 0 to 1.
| |
g8 |
Wrapper for g that uses the range 0 to 255 instead of 0 to 1.
| |
h |
The HSV hue of this color, on the range 0 to 1.
| |
Item |
Access color components using their index.
| |
r8 |
Wrapper for r that uses the range 0 to 255 instead of 0 to 1.
| |
s |
The HSV saturation of this color, on the range 0 to 1.
| |
v |
The HSV value (brightness) of this color, on the range 0 to 1.
|
Name | Description | |
---|---|---|
Blend |
Returns a new color resulting from blending this color over another.
If the color is opaque, the result is also opaque.
The second color may have a range of alpha values.
| |
Color8 |
Returns a color constructed from integer red, green, blue, and alpha channels.
Each channel should have 8 bits of information ranging from 0 to 255.
| |
ColorN |
Returns a color according to the standardized name, with the
specified alpha value. Supported color names are the same as
the constants defined in Colors.
| |
Contrasted |
Returns the most contrasting color.
| |
Darkened |
Returns a new color resulting from making this color darker
by the specified ratio (on the range of 0 to 1).
| |
Equals(Object) | (Overrides ValueTypeEquals(Object).) | |
Equals(Color) | ||
FromHsv |
Constructs a color from an HSV profile, with values on the
range of 0 to 1. This is equivalent to using each of
the `h`/`s`/`v` properties, but much more efficient.
| |
GetHashCode | (Overrides ValueTypeGetHashCode.) | |
GetType | (Inherited from Object.) | |
Inverted |
Returns the inverted color: `(1 - r, 1 - g, 1 - b, a)`.
| |
IsEqualApprox |
Returns true if this color and `other` are approximately equal, by running
IsEqualApprox(Single, Single) on each component.
| |
Lightened |
Returns a new color resulting from making this color lighter
by the specified ratio (on the range of 0 to 1).
| |
LinearInterpolate(Color, Color) |
Returns the result of the linear interpolation between
this color and `to` by color amount `weight`.
| |
LinearInterpolate(Color, Single) |
Returns the result of the linear interpolation between
this color and `to` by amount `weight`.
| |
ToAbgr32 |
Returns the color converted to a 32-bit integer in ABGR
format (each byte represents a color channel).
ABGR is the reversed version of the default format.
| |
ToAbgr64 |
Returns the color converted to a 64-bit integer in ABGR
format (each word represents a color channel).
ABGR is the reversed version of the default format.
| |
ToArgb32 |
Returns the color converted to a 32-bit integer in ARGB
format (each byte represents a color channel).
ARGB is more compatible with DirectX, but not used much in Godot.
| |
ToArgb64 |
Returns the color converted to a 64-bit integer in ARGB
format (each word represents a color channel).
ARGB is more compatible with DirectX, but not used much in Godot.
| |
ToHsv |
Converts a color to HSV values. This is equivalent to using each of
the `h`/`s`/`v` properties, but much more efficient.
| |
ToHtml |
Returns the color's HTML hexadecimal color string in RGBA format.
| |
ToRgba32 |
Returns the color converted to a 32-bit integer in RGBA
format (each byte represents a color channel).
RGBA is Godot's default and recommended format.
| |
ToRgba64 |
Returns the color converted to a 64-bit integer in RGBA
format (each word represents a color channel).
RGBA is Godot's default and recommended format.
| |
ToString | (Overrides ValueTypeToString.) | |
ToString(String) |
Name | Description | |
---|---|---|
Addition | ||
Division(Color, Color) | ||
Division(Color, Single) | ||
Equality | ||
GreaterThan | ||
Inequality | ||
LessThan | ||
Multiply(Single, Color) | ||
Multiply(Color, Color) | ||
Multiply(Color, Single) | ||
Subtraction | ||
UnaryNegation |
Name | Description | |
---|---|---|
a |
The color's alpha (transparency) component, typically on the range of 0 to 1.
| |
b |
The color's blue component, typically on the range of 0 to 1.
| |
g |
The color's green component, typically on the range of 0 to 1.
| |
r |
The color's red component, typically on the range of 0 to 1.
|