Color
Category: Built-In Types
Brief Description
Color in RGBA format.
Member Functions
Color | Color ( float r, float g, float b, float a ) |
Color | Color ( float r, float g, float b ) |
Color | Color ( int from ) |
Color | Color ( String from ) |
Color | blend ( Color over ) |
Color | contrasted ( ) |
float | gray ( ) |
Color | inverted ( ) |
Color | linear_interpolate ( Color b, float t ) |
int | to_32 ( ) |
int | to_ARGB32 ( ) |
String | to_html ( bool with_alpha=True ) |
Member Variables
- float a - Alpha (0 to 1)
- int a8 - Alpha (0 to 255)
- float b - Blue (0 to 1)
- int b8 - Blue (0 to 255)
- float g - Green (0 to 1)
- int g8 - Green (0 to 255)
- float h - Hue (0 to 1)
- float r - Red (0 to 1)
- int r8 - Red (0 to 255)
- float s - Saturation (0 to 1)
- float v - Value (0 to 1)
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() ) may accept values > 1.
Member Function Description
Color Color ( float r, float g, float b, float a )
Construct the color from an RGBA profile.
Color Color ( float r, float g, float b )
Construct the color from an RGBA profile.
Color Color ( int from )
Construct the color from an RGBA profile.
Color Color ( String from )
Construct the color from an RGBA profile.
Color blend ( Color over )
Return a new color blended with anothor one.
Color contrasted ( )
Return the most contrasting color with this one.
float gray ( )
Convert the color to gray.
Color inverted ( )
Return the inverted color (1-r, 1-g, 1-b, 1-a).
Color linear_interpolate ( Color b, float t )
Return the linear interpolation with another color.
int to_32 ( )
Convert the color to a 32 its integer (each byte represents a RGBA).
int to_ARGB32 ( )
Convert color to ARGB32, more compatible with DirectX.
String to_html ( bool with_alpha=True )
Return the HTML hexadecimal color string.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/2.1/classes/class_color.html