Inheritance #
Table of contents
-
var a: float = 1.0 -
var a8: int = 255 -
var b: float = 0.0 -
var b8: int = 0 -
var g: float = 0.0 -
var g8: int = 0 -
var h: float = 0.0 -
var ok_hsl_h: float = 0.0 -
var ok_hsl_l: float = 0.0 -
var ok_hsl_s: float = 0.0 -
var r: float = 0.0 -
var r8: int = 0 -
var s: float = 0.0 -
var v: float = 0.0 -
const func blend(over: Color) -> Color -
const func clamp(max: Color = Color(1, 1, 1, 1)) -> Color -
const func darkened(amount: float) -> Color -
static func from_hsv(alpha: float = 1.0) -> Color -
static func from_ok_hsl(alpha: float = 1.0) -> Color -
static func from_rgba8(a8: int = 255) -> Color -
static func from_rgbe9995(rgbe: int) -> Color -
static func from_string(default: Color) -> Color -
const func get_luminance() -> float -
static func hex(hex: int) -> Color -
static func hex64(hex: int) -> Color -
static func html(rgba: String) -> Color -
static func html_is_valid(color: String) -> bool -
const func inverted() -> Color -
const func is_equal_approx(to: Color) -> bool -
const func lerp(weight: float) -> Color -
const func lightened(amount: float) -> Color -
const func linear_to_srgb() -> Color -
const func srgb_to_linear() -> Color -
const func to_abgr32() -> int -
const func to_abgr64() -> int -
const func to_argb32() -> int -
const func to_argb64() -> int -
const func to_html(with_alpha: bool = true) -> String -
const func to_rgba32() -> int -
const func to_rgba64() -> int -
const ALICE_BLUE = Color(0.941176, 0.972549, 1, 1) -
const ANTIQUE_WHITE = Color(0.980392, 0.921569, 0.843137, 1) -
const AQUA = Color(0, 1, 1, 1) -
const AQUAMARINE = Color(0.498039, 1, 0.831373, 1) -
const AZURE = Color(0.941176, 1, 1, 1) -
const BEIGE = Color(0.960784, 0.960784, 0.862745, 1) -
const BISQUE = Color(1, 0.894118, 0.768627, 1) -
const BLACK = Color(0, 0, 0, 1) -
const BLANCHED_ALMOND = Color(1, 0.921569, 0.803922, 1) -
const BLUE = Color(0, 0, 1, 1) -
const BLUE_VIOLET = Color(0.541176, 0.168627, 0.886275, 1) -
const BROWN = Color(0.647059, 0.164706, 0.164706, 1) -
const BURLYWOOD = Color(0.870588, 0.721569, 0.529412, 1) -
const CADET_BLUE = Color(0.372549, 0.619608, 0.627451, 1) -
const CHARTREUSE = Color(0.498039, 1, 0, 1) -
const CHOCOLATE = Color(0.823529, 0.411765, 0.117647, 1) -
const CORAL = Color(1, 0.498039, 0.313726, 1) -
const CORNFLOWER_BLUE = Color(0.392157, 0.584314, 0.929412, 1) -
const CORNSILK = Color(1, 0.972549, 0.862745, 1) -
const CRIMSON = Color(0.862745, 0.0784314, 0.235294, 1) -
const CYAN = Color(0, 1, 1, 1) -
const DARK_BLUE = Color(0, 0, 0.545098, 1) -
const DARK_CYAN = Color(0, 0.545098, 0.545098, 1) -
const DARK_GOLDENROD = Color(0.721569, 0.52549, 0.0431373, 1) -
const DARK_GRAY = Color(0.662745, 0.662745, 0.662745, 1) -
const DARK_GREEN = Color(0, 0.392157, 0, 1) -
const DARK_KHAKI = Color(0.741176, 0.717647, 0.419608, 1) -
const DARK_MAGENTA = Color(0.545098, 0, 0.545098, 1) -
const DARK_OLIVE_GREEN = Color(0.333333, 0.419608, 0.184314, 1) -
const DARK_ORANGE = Color(1, 0.54902, 0, 1) -
const DARK_ORCHID = Color(0.6, 0.196078, 0.8, 1) -
const DARK_RED = Color(0.545098, 0, 0, 1) -
const DARK_SALMON = Color(0.913725, 0.588235, 0.478431, 1) -
const DARK_SEA_GREEN = Color(0.560784, 0.737255, 0.560784, 1) -
const DARK_SLATE_BLUE = Color(0.282353, 0.239216, 0.545098, 1) -
const DARK_SLATE_GRAY = Color(0.184314, 0.309804, 0.309804, 1) -
const DARK_TURQUOISE = Color(0, 0.807843, 0.819608, 1) -
const DARK_VIOLET = Color(0.580392, 0, 0.827451, 1) -
const DEEP_PINK = Color(1, 0.0784314, 0.576471, 1) -
const DEEP_SKY_BLUE = Color(0, 0.74902, 1, 1) -
const DIM_GRAY = Color(0.411765, 0.411765, 0.411765, 1) -
const DODGER_BLUE = Color(0.117647, 0.564706, 1, 1) -
const FIREBRICK = Color(0.698039, 0.133333, 0.133333, 1) -
const FLORAL_WHITE = Color(1, 0.980392, 0.941176, 1) -
const FOREST_GREEN = Color(0.133333, 0.545098, 0.133333, 1) -
const FUCHSIA = Color(1, 0, 1, 1) -
const GAINSBORO = Color(0.862745, 0.862745, 0.862745, 1) -
const GHOST_WHITE = Color(0.972549, 0.972549, 1, 1) -
const GOLD = Color(1, 0.843137, 0, 1) -
const GOLDENROD = Color(0.854902, 0.647059, 0.12549, 1) -
const GRAY = Color(0.745098, 0.745098, 0.745098, 1) -
const GREEN = Color(0, 1, 0, 1) -
const GREEN_YELLOW = Color(0.678431, 1, 0.184314, 1) -
const HONEYDEW = Color(0.941176, 1, 0.941176, 1) -
const HOT_PINK = Color(1, 0.411765, 0.705882, 1) -
const INDIAN_RED = Color(0.803922, 0.360784, 0.360784, 1) -
const INDIGO = Color(0.294118, 0, 0.509804, 1) -
const IVORY = Color(1, 1, 0.941176, 1) -
const KHAKI = Color(0.941176, 0.901961, 0.54902, 1) -
const LAVENDER = Color(0.901961, 0.901961, 0.980392, 1) -
const LAVENDER_BLUSH = Color(1, 0.941176, 0.960784, 1) -
const LAWN_GREEN = Color(0.486275, 0.988235, 0, 1) -
const LEMON_CHIFFON = Color(1, 0.980392, 0.803922, 1) -
const LIGHT_BLUE = Color(0.678431, 0.847059, 0.901961, 1) -
const LIGHT_CORAL = Color(0.941176, 0.501961, 0.501961, 1) -
const LIGHT_CYAN = Color(0.878431, 1, 1, 1) -
const LIGHT_GOLDENROD = Color(0.980392, 0.980392, 0.823529, 1) -
const LIGHT_GRAY = Color(0.827451, 0.827451, 0.827451, 1) -
const LIGHT_GREEN = Color(0.564706, 0.933333, 0.564706, 1) -
const LIGHT_PINK = Color(1, 0.713726, 0.756863, 1) -
const LIGHT_SALMON = Color(1, 0.627451, 0.478431, 1) -
const LIGHT_SEA_GREEN = Color(0.12549, 0.698039, 0.666667, 1) -
const LIGHT_SKY_BLUE = Color(0.529412, 0.807843, 0.980392, 1) -
const LIGHT_SLATE_GRAY = Color(0.466667, 0.533333, 0.6, 1) -
const LIGHT_STEEL_BLUE = Color(0.690196, 0.768627, 0.870588, 1) -
const LIGHT_YELLOW = Color(1, 1, 0.878431, 1) -
const LIME = Color(0, 1, 0, 1) -
const LIME_GREEN = Color(0.196078, 0.803922, 0.196078, 1) -
const LINEN = Color(0.980392, 0.941176, 0.901961, 1) -
const MAGENTA = Color(1, 0, 1, 1) -
const MAROON = Color(0.690196, 0.188235, 0.376471, 1) -
const MEDIUM_AQUAMARINE = Color(0.4, 0.803922, 0.666667, 1) -
const MEDIUM_BLUE = Color(0, 0, 0.803922, 1) -
const MEDIUM_ORCHID = Color(0.729412, 0.333333, 0.827451, 1) -
const MEDIUM_PURPLE = Color(0.576471, 0.439216, 0.858824, 1) -
const MEDIUM_SEA_GREEN = Color(0.235294, 0.701961, 0.443137, 1) -
const MEDIUM_SLATE_BLUE = Color(0.482353, 0.407843, 0.933333, 1) -
const MEDIUM_SPRING_GREEN = Color(0, 0.980392, 0.603922, 1) -
const MEDIUM_TURQUOISE = Color(0.282353, 0.819608, 0.8, 1) -
const MEDIUM_VIOLET_RED = Color(0.780392, 0.0823529, 0.521569, 1) -
const MIDNIGHT_BLUE = Color(0.0980392, 0.0980392, 0.439216, 1) -
const MINT_CREAM = Color(0.960784, 1, 0.980392, 1) -
const MISTY_ROSE = Color(1, 0.894118, 0.882353, 1) -
const MOCCASIN = Color(1, 0.894118, 0.709804, 1) -
const NAVAJO_WHITE = Color(1, 0.870588, 0.678431, 1) -
const NAVY_BLUE = Color(0, 0, 0.501961, 1) -
const OLD_LACE = Color(0.992157, 0.960784, 0.901961, 1) -
const OLIVE = Color(0.501961, 0.501961, 0, 1) -
const OLIVE_DRAB = Color(0.419608, 0.556863, 0.137255, 1) -
const ORANGE = Color(1, 0.647059, 0, 1) -
const ORANGE_RED = Color(1, 0.270588, 0, 1) -
const ORCHID = Color(0.854902, 0.439216, 0.839216, 1) -
const PALE_GOLDENROD = Color(0.933333, 0.909804, 0.666667, 1) -
const PALE_GREEN = Color(0.596078, 0.984314, 0.596078, 1) -
const PALE_TURQUOISE = Color(0.686275, 0.933333, 0.933333, 1) -
const PALE_VIOLET_RED = Color(0.858824, 0.439216, 0.576471, 1) -
const PAPAYA_WHIP = Color(1, 0.937255, 0.835294, 1) -
const PEACH_PUFF = Color(1, 0.854902, 0.72549, 1) -
const PERU = Color(0.803922, 0.521569, 0.247059, 1) -
const PINK = Color(1, 0.752941, 0.796078, 1) -
const PLUM = Color(0.866667, 0.627451, 0.866667, 1) -
const POWDER_BLUE = Color(0.690196, 0.878431, 0.901961, 1) -
const PURPLE = Color(0.627451, 0.12549, 0.941176, 1) -
const REBECCA_PURPLE = Color(0.4, 0.2, 0.6, 1) -
const RED = Color(1, 0, 0, 1) -
const ROSY_BROWN = Color(0.737255, 0.560784, 0.560784, 1) -
const ROYAL_BLUE = Color(0.254902, 0.411765, 0.882353, 1) -
const SADDLE_BROWN = Color(0.545098, 0.270588, 0.0745098, 1) -
const SALMON = Color(0.980392, 0.501961, 0.447059, 1) -
const SANDY_BROWN = Color(0.956863, 0.643137, 0.376471, 1) -
const SEA_GREEN = Color(0.180392, 0.545098, 0.341176, 1) -
const SEASHELL = Color(1, 0.960784, 0.933333, 1) -
const SIENNA = Color(0.627451, 0.321569, 0.176471, 1) -
const SILVER = Color(0.752941, 0.752941, 0.752941, 1) -
const SKY_BLUE = Color(0.529412, 0.807843, 0.921569, 1) -
const SLATE_BLUE = Color(0.415686, 0.352941, 0.803922, 1) -
const SLATE_GRAY = Color(0.439216, 0.501961, 0.564706, 1) -
const SNOW = Color(1, 0.980392, 0.980392, 1) -
const SPRING_GREEN = Color(0, 1, 0.498039, 1) -
const STEEL_BLUE = Color(0.27451, 0.509804, 0.705882, 1) -
const TAN = Color(0.823529, 0.705882, 0.54902, 1) -
const TEAL = Color(0, 0.501961, 0.501961, 1) -
const THISTLE = Color(0.847059, 0.74902, 0.847059, 1) -
const TOMATO = Color(1, 0.388235, 0.278431, 1) -
const TRANSPARENT = Color(1, 1, 1, 0) -
const TURQUOISE = Color(0.25098, 0.878431, 0.815686, 1) -
const VIOLET = Color(0.933333, 0.509804, 0.933333, 1) -
const WEB_GRAY = Color(0.501961, 0.501961, 0.501961, 1) -
const WEB_GREEN = Color(0, 0.501961, 0, 1) -
const WEB_MAROON = Color(0.501961, 0, 0, 1) -
const WEB_PURPLE = Color(0.501961, 0, 0.501961, 1) -
const WHEAT = Color(0.960784, 0.870588, 0.701961, 1) -
const WHITE = Color(1, 1, 1, 1) -
const WHITE_SMOKE = Color(0.960784, 0.960784, 0.960784, 1) -
const YELLOW = Color(1, 1, 0, 1) -
const YELLOW_GREEN = Color(0.603922, 0.803922, 0.196078, 1) -
Color() -> Color -
Color(alpha: float) -> Color -
Color(from: Color) -> Color -
Color(code: String) -> Color -
Color(alpha: float) -> Color -
Color(b: float) -> Color -
Color(a: float) -> Color -
Color != Color -> bool -
Color * Color -> Color -
Color * float -> Color -
Color * int -> Color -
Color + Color -> Color -
Color - Color -> Color -
Color / Color -> Color -
Color / float -> Color -
Color / int -> Color -
Color == Color -> bool -
Color[int] -> float -
+Color -> Color -
-Color -> Color
Color #
A color represented in RGBA format.
A color represented in RGBA format by a red (r), green (g), blue (b), and alpha (a) component. Each component is a 32-bit floating-point value, usually ranging from 0.0 to 1.0. Some properties (such as CanvasItem.modulate) may support values greater than 1.0, for overbright or HDR (High Dynamic Range) colors.
Colors can be created in various ways: By the various Color constructors, by static methods such as from_hsv, and by using a name from the set of standardized colors based on X11 color names with the addition of TRANSPARENT. GDScript also provides @GDScript.Color8, which uses integers from 0 to 255 and doesn't support overbright colors.
Note: In a boolean context, a Color will evaluate to false if it is equal to Color(0, 0, 0, 1) (opaque black). Otherwise, a Color will always evaluate to true.
Members #
var a: float = 1.0#
The color's alpha component, typically on the range of 0 to 1. A value of 0 means that the color is fully transparent. A value of 1 means that the color is fully opaque.
var a8: int = 255#
Wrapper for a that uses the range 0 to 255, instead of 0 to 1.
var b: float = 0.0#
The color's blue component, typically on the range of 0 to 1.
var b8: int = 0#
Wrapper for b that uses the range 0 to 255, instead of 0 to 1.
var g: float = 0.0#
The color's green component, typically on the range of 0 to 1.
var g8: int = 0#
Wrapper for g that uses the range 0 to 255, instead of 0 to 1.
var h: float = 0.0#
The HSV hue of this color, on the range 0 to 1.
var ok_hsl_h: float = 0.0#
The OKHSL hue of this color, on the range 0 to 1.
var ok_hsl_l: float = 0.0#
The OKHSL lightness of this color, on the range 0 to 1.
var ok_hsl_s: float = 0.0#
The OKHSL saturation of this color, on the range 0 to 1.
var r: float = 0.0#
The color's red component, typically on the range of 0 to 1.
var r8: int = 0#
Wrapper for r that uses the range 0 to 255, instead of 0 to 1.
var s: float = 0.0#
The HSV saturation of this color, on the range 0 to 1.
var v: float = 0.0#
The HSV value (brightness) of this color, on the range 0 to 1.
Methods #
const func blend(over: Color) -> Color#
Returns a new color resulting from overlaying this color over the given color. In a painting program, you can imagine it as the over color painted over this color (including alpha).
GDScript
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, 0.5) # Red with alpha of 50%
var blended_color = bg.blend(fg) # Brown with alpha of 75%C#
var bg = new Color(0.0f, 1.0f, 0.0f, 0.5f); // Green with alpha of 50%
var fg = new Color(1.0f, 0.0f, 0.0f, 0.5f); // Red with alpha of 50%
Color blendedColor = bg.Blend(fg); // Brown with alpha of 75%const func clamp(max: Color = Color(1, 1, 1, 1)) -> Color#
Returns a new color with all components clamped between the components of min and max, by running @GlobalScope.clamp on each component.
const func darkened(amount: float) -> Color#
Returns a new color resulting from making this color darker by the specified amount (ratio from 0.0 to 1.0). See also lightened.
GDScript
var green = Color(0.0, 1.0, 0.0)
var darkgreen = green.darkened(0.2) # 20% darker than regular greenC#
var green = new Color(0.0f, 1.0f, 0.0f);
Color darkgreen = green.Darkened(0.2f); // 20% darker than regular greenstatic func from_hsv(alpha: float = 1.0) -> Color#
Constructs a color from an HSV profile. The hue (h), saturation (s), and value (v) are typically between 0.0 and 1.0.
GDScript
var color = Color.from_hsv(0.58, 0.5, 0.79, 0.8)C#
var color = Color.FromHsv(0.58f, 0.5f, 0.79f, 0.8f);static func from_ok_hsl(alpha: float = 1.0) -> Color#
Constructs a color from an OK HSL profile. The hue (h), saturation (s), and lightness (l) are typically between 0.0 and 1.0.
GDScript
var color = Color.from_ok_hsl(0.58, 0.5, 0.79, 0.8)C#
var color = Color.FromOkHsl(0.58f, 0.5f, 0.79f, 0.8f);static func from_rgba8(a8: int = 255) -> Color#
Returns a Color constructed from red (r8), green (g8), blue (b8), and optionally alpha (a8) integer channels, each divided by 255.0 for their final value.
var red = Color.from_rgba8(255, 0, 0) # Same as Color(1, 0, 0).
var dark_blue = Color.from_rgba8(0, 0, 51) # Same as Color(0, 0, 0.2).
var my_color = Color.from_rgba8(306, 255, 0, 102) # Same as Color(1.2, 1, 0, 0.4).Note: Due to the lower precision of from_rgba8 compared to the standard Color constructor, a color created with from_rgba8 will generally not be equal to the same color created with the standard Color constructor. Use is_equal_approx for comparisons to avoid issues with floating-point precision error.
static func from_rgbe9995(rgbe: int) -> Color#
Decodes a Color from an RGBE9995 format integer. See Image.FORMAT_RGBE9995.
static func from_string(default: Color) -> Color#
Creates a Color from the given string, which can be either an HTML color code or a named color (case-insensitive). Returns default if the color cannot be inferred from the string.
If you want to create a color from String in a constant expression, use the equivalent constructor instead (i.e. Color("color string")).
const func get_luminance() -> float#
Returns the light intensity of the color, as a value between 0.0 and 1.0 (inclusive). This is useful when determining light or dark color. Colors with a luminance smaller than 0.5 can be generally considered dark.
Note: get_luminance relies on the color being in the linear color space to return an accurate relative luminance value. If the color is in the sRGB color space, use srgb_to_linear to convert it to the linear color space first.
static func hex(hex: int) -> Color#
Returns the Color associated with the provided hex integer in 32-bit RGBA format (8 bits per channel). This method is the inverse of to_rgba32.
In GDScript and C#, the int is best visualized with hexadecimal notation ("0x" prefix, making it "0xRRGGBBAA").
GDScript
var red = Color.hex(0xff0000ff)
var dark_cyan = Color.hex(0x008b8bff)
var my_color = Color.hex(0xbbefd2a4)C#
var red = new Color(0xff0000ff);
var dark_cyan = new Color(0x008b8bff);
var my_color = new Color(0xbbefd2a4);If you want to use hex notation in a constant expression, use the equivalent constructor instead (i.e. Color(0xRRGGBBAA)).
static func hex64(hex: int) -> Color#
Returns the Color associated with the provided hex integer in 64-bit RGBA format (16 bits per channel). This method is the inverse of to_rgba64.
In GDScript and C#, the int is best visualized with hexadecimal notation ("0x" prefix, making it "0xRRRRGGGGBBBBAAAA").
static func html(rgba: String) -> Color#
Returns a new color from rgba, an HTML hexadecimal color string. rgba is not case-sensitive, and may be prefixed by a hash sign (#).
rgba must be a valid three-digit or six-digit hexadecimal color string, and may contain an alpha channel value. If rgba does not contain an alpha channel value, an alpha channel value of 1.0 is applied. If rgba is invalid, returns an empty color.
GDScript
var blue = Color.html("#0000ff") # blue is Color(0.0, 0.0, 1.0, 1.0)
var green = Color.html("#0F0") # green is Color(0.0, 1.0, 0.0, 1.0)
var col = Color.html("663399cc") # col is Color(0.4, 0.2, 0.6, 0.8)C#
var blue = Color.FromHtml("#0000ff"); // blue is Color(0.0, 0.0, 1.0, 1.0)
var green = Color.FromHtml("#0F0"); // green is Color(0.0, 1.0, 0.0, 1.0)
var col = Color.FromHtml("663399cc"); // col is Color(0.4, 0.2, 0.6, 0.8)static func html_is_valid(color: String) -> bool#
Returns true if color is a valid HTML hexadecimal color string. The string must be a hexadecimal value (case-insensitive) of either 3, 4, 6 or 8 digits, and may be prefixed by a hash sign (#). This method is identical to String.is_valid_html_color.
GDScript
Color.html_is_valid("#55aaFF") # Returns true
Color.html_is_valid("#55AAFF20") # Returns true
Color.html_is_valid("55AAFF") # Returns true
Color.html_is_valid("#F2C") # Returns true
Color.html_is_valid("#AABBC") # Returns false
Color.html_is_valid("#55aaFF5") # Returns falseC#
Color.HtmlIsValid("#55AAFF"); // Returns true
Color.HtmlIsValid("#55AAFF20"); // Returns true
Color.HtmlIsValid("55AAFF"); // Returns true
Color.HtmlIsValid("#F2C"); // Returns true
Color.HtmlIsValid("#AABBC"); // Returns false
Color.HtmlIsValid("#55aaFF5"); // Returns falseconst func inverted() -> Color#
Returns the color with its r, g, and b components inverted ((1 - r, 1 - g, 1 - b, a)).
GDScript
var black = Color.WHITE.inverted()
var color = Color(0.3, 0.4, 0.9)
var inverted_color = color.inverted() # Equivalent to `Color(0.7, 0.6, 0.1)`C#
var black = Colors.White.Inverted();
var color = new Color(0.3f, 0.4f, 0.9f);
Color invertedColor = color.Inverted(); // Equivalent to `new Color(0.7f, 0.6f, 0.1f)`const func is_equal_approx(to: Color) -> bool#
Returns true if this color and to are approximately equal, by running @GlobalScope.is_equal_approx on each component.
const func lerp(weight: float) -> Color#
Returns the linear interpolation between this color's components and to's components. The interpolation factor weight should be between 0.0 and 1.0 (inclusive). See also @GlobalScope.lerp.
GDScript
var red = Color(1.0, 0.0, 0.0)
var aqua = Color(0.0, 1.0, 0.8)
red.lerp(aqua, 0.2) # Returns Color(0.8, 0.2, 0.16)
red.lerp(aqua, 0.5) # Returns Color(0.5, 0.5, 0.4)
red.lerp(aqua, 1.0) # Returns Color(0.0, 1.0, 0.8)C#
var red = new Color(1.0f, 0.0f, 0.0f);
var aqua = new Color(0.0f, 1.0f, 0.8f);
red.Lerp(aqua, 0.2f); // Returns Color(0.8f, 0.2f, 0.16f)
red.Lerp(aqua, 0.5f); // Returns Color(0.5f, 0.5f, 0.4f)
red.Lerp(aqua, 1.0f); // Returns Color(0.0f, 1.0f, 0.8f)const func lightened(amount: float) -> Color#
Returns a new color resulting from making this color lighter by the specified amount, which should be a ratio from 0.0 to 1.0. See also darkened.
GDScript
var green = Color(0.0, 1.0, 0.0)
var light_green = green.lightened(0.2) # 20% lighter than regular greenC#
var green = new Color(0.0f, 1.0f, 0.0f);
Color lightGreen = green.Lightened(0.2f); // 20% lighter than regular greenconst func linear_to_srgb() -> Color#
Returns the color converted to the sRGB color space. This method assumes the original color is in the linear color space. See also srgb_to_linear which performs the opposite operation.
const func srgb_to_linear() -> Color#
Returns the color converted to the linear color space. This method assumes the original color already is in the sRGB color space. See also linear_to_srgb which performs the opposite operation.
const func to_abgr32() -> int#
Returns the color converted to a 32-bit integer in ABGR format (each component is 8 bits). ABGR is the reversed version of the default RGBA format.
GDScript
var color = Color(1, 0.5, 0.2)
print(color.to_abgr32()) # Prints 4281565439C#
var color = new Color(1.0f, 0.5f, 0.2f);
GD.Print(color.ToAbgr32()); // Prints 4281565439const func to_abgr64() -> int#
Returns the color converted to a 64-bit integer in ABGR format (each component is 16 bits). ABGR is the reversed version of the default RGBA format.
GDScript
var color = Color(1, 0.5, 0.2)
print(color.to_abgr64()) # Prints -225178692812801C#
var color = new Color(1.0f, 0.5f, 0.2f);
GD.Print(color.ToAbgr64()); // Prints -225178692812801const func to_argb32() -> int#
Returns the color converted to a 32-bit integer in ARGB format (each component is 8 bits). ARGB is more compatible with DirectX.
GDScript
var color = Color(1, 0.5, 0.2)
print(color.to_argb32()) # Prints 4294934323C#
var color = new Color(1.0f, 0.5f, 0.2f);
GD.Print(color.ToArgb32()); // Prints 4294934323const func to_argb64() -> int#
Returns the color converted to a 64-bit integer in ARGB format (each component is 16 bits). ARGB is more compatible with DirectX.
GDScript
var color = Color(1, 0.5, 0.2)
print(color.to_argb64()) # Prints -2147470541C#
var color = new Color(1.0f, 0.5f, 0.2f);
GD.Print(color.ToArgb64()); // Prints -2147470541const func to_html(with_alpha: bool = true) -> String#
Returns the color converted to an HTML hexadecimal color String in RGBA format, without the hash (#) prefix.
Setting with_alpha to false, excludes alpha from the hexadecimal string, using RGB format instead of RGBA format.
GDScript
var white = Color(1, 1, 1, 0.5)
var with_alpha = white.to_html() # Returns "ffffff7f"
var without_alpha = white.to_html(false) # Returns "ffffff"C#
var white = new Color(1, 1, 1, 0.5f);
string withAlpha = white.ToHtml(); // Returns "ffffff7f"
string withoutAlpha = white.ToHtml(false); // Returns "ffffff"const func to_rgba32() -> int#
Returns the color converted to a 32-bit integer in RGBA format (each component is 8 bits). RGBA is Godot's default format. This method is the inverse of hex.
GDScript
var color = Color(1, 0.5, 0.2)
print(color.to_rgba32()) # Prints 4286526463C#
var color = new Color(1, 0.5f, 0.2f);
GD.Print(color.ToRgba32()); // Prints 4286526463const func to_rgba64() -> int#
Returns the color converted to a 64-bit integer in RGBA format (each component is 16 bits). RGBA is Godot's default format. This method is the inverse of hex64.
GDScript
var color = Color(1, 0.5, 0.2)
print(color.to_rgba64()) # Prints -140736629309441C#
var color = new Color(1, 0.5f, 0.2f);
GD.Print(color.ToRgba64()); // Prints -140736629309441Annotations #
Constants #
const ALICE_BLUE = Color(0.941176, 0.972549, 1, 1)#
Alice blue color.
const ANTIQUE_WHITE = Color(0.980392, 0.921569, 0.843137, 1)#
Antique white color.
const AQUA = Color(0, 1, 1, 1)#
Aqua color.
const AQUAMARINE = Color(0.498039, 1, 0.831373, 1)#
Aquamarine color.
const AZURE = Color(0.941176, 1, 1, 1)#
Azure color.
const BEIGE = Color(0.960784, 0.960784, 0.862745, 1)#
Beige color.
const BISQUE = Color(1, 0.894118, 0.768627, 1)#
Bisque color.
const BLACK = Color(0, 0, 0, 1)#
Black color. In GDScript, this is the default value of any color.
const BLANCHED_ALMOND = Color(1, 0.921569, 0.803922, 1)#
Blanched almond color.
const BLUE = Color(0, 0, 1, 1)#
Blue color.
const BLUE_VIOLET = Color(0.541176, 0.168627, 0.886275, 1)#
Blue violet color.
const BROWN = Color(0.647059, 0.164706, 0.164706, 1)#
Brown color.
const BURLYWOOD = Color(0.870588, 0.721569, 0.529412, 1)#
Burlywood color.
const CADET_BLUE = Color(0.372549, 0.619608, 0.627451, 1)#
Cadet blue color.
const CHARTREUSE = Color(0.498039, 1, 0, 1)#
Chartreuse color.
const CHOCOLATE = Color(0.823529, 0.411765, 0.117647, 1)#
Chocolate color.
const CORAL = Color(1, 0.498039, 0.313726, 1)#
Coral color.
const CORNFLOWER_BLUE = Color(0.392157, 0.584314, 0.929412, 1)#
Cornflower blue color.
const CORNSILK = Color(1, 0.972549, 0.862745, 1)#
Cornsilk color.
const CRIMSON = Color(0.862745, 0.0784314, 0.235294, 1)#
Crimson color.
const CYAN = Color(0, 1, 1, 1)#
Cyan color.
const DARK_BLUE = Color(0, 0, 0.545098, 1)#
Dark blue color.
const DARK_CYAN = Color(0, 0.545098, 0.545098, 1)#
Dark cyan color.
const DARK_GOLDENROD = Color(0.721569, 0.52549, 0.0431373, 1)#
Dark goldenrod color.
const DARK_GRAY = Color(0.662745, 0.662745, 0.662745, 1)#
Dark gray color.
const DARK_GREEN = Color(0, 0.392157, 0, 1)#
Dark green color.
const DARK_KHAKI = Color(0.741176, 0.717647, 0.419608, 1)#
Dark khaki color.
const DARK_MAGENTA = Color(0.545098, 0, 0.545098, 1)#
Dark magenta color.
const DARK_OLIVE_GREEN = Color(0.333333, 0.419608, 0.184314, 1)#
Dark olive green color.
const DARK_ORANGE = Color(1, 0.54902, 0, 1)#
Dark orange color.
const DARK_ORCHID = Color(0.6, 0.196078, 0.8, 1)#
Dark orchid color.
const DARK_RED = Color(0.545098, 0, 0, 1)#
Dark red color.
const DARK_SALMON = Color(0.913725, 0.588235, 0.478431, 1)#
Dark salmon color.
const DARK_SEA_GREEN = Color(0.560784, 0.737255, 0.560784, 1)#
Dark sea green color.
const DARK_SLATE_BLUE = Color(0.282353, 0.239216, 0.545098, 1)#
Dark slate blue color.
const DARK_SLATE_GRAY = Color(0.184314, 0.309804, 0.309804, 1)#
Dark slate gray color.
const DARK_TURQUOISE = Color(0, 0.807843, 0.819608, 1)#
Dark turquoise color.
const DARK_VIOLET = Color(0.580392, 0, 0.827451, 1)#
Dark violet color.
const DEEP_PINK = Color(1, 0.0784314, 0.576471, 1)#
Deep pink color.
const DEEP_SKY_BLUE = Color(0, 0.74902, 1, 1)#
Deep sky blue color.
const DIM_GRAY = Color(0.411765, 0.411765, 0.411765, 1)#
Dim gray color.
const DODGER_BLUE = Color(0.117647, 0.564706, 1, 1)#
Dodger blue color.
const FIREBRICK = Color(0.698039, 0.133333, 0.133333, 1)#
Firebrick color.
const FLORAL_WHITE = Color(1, 0.980392, 0.941176, 1)#
Floral white color.
const FOREST_GREEN = Color(0.133333, 0.545098, 0.133333, 1)#
Forest green color.
const FUCHSIA = Color(1, 0, 1, 1)#
Fuchsia color.
const GAINSBORO = Color(0.862745, 0.862745, 0.862745, 1)#
Gainsboro color.
const GHOST_WHITE = Color(0.972549, 0.972549, 1, 1)#
Ghost white color.
const GOLD = Color(1, 0.843137, 0, 1)#
Gold color.
const GOLDENROD = Color(0.854902, 0.647059, 0.12549, 1)#
Goldenrod color.
const GRAY = Color(0.745098, 0.745098, 0.745098, 1)#
Gray color.
const GREEN = Color(0, 1, 0, 1)#
Green color.
const GREEN_YELLOW = Color(0.678431, 1, 0.184314, 1)#
Green yellow color.
const HONEYDEW = Color(0.941176, 1, 0.941176, 1)#
Honeydew color.
const HOT_PINK = Color(1, 0.411765, 0.705882, 1)#
Hot pink color.
const INDIAN_RED = Color(0.803922, 0.360784, 0.360784, 1)#
Indian red color.
const INDIGO = Color(0.294118, 0, 0.509804, 1)#
Indigo color.
const IVORY = Color(1, 1, 0.941176, 1)#
Ivory color.
const KHAKI = Color(0.941176, 0.901961, 0.54902, 1)#
Khaki color.
const LAVENDER = Color(0.901961, 0.901961, 0.980392, 1)#
Lavender color.
const LAVENDER_BLUSH = Color(1, 0.941176, 0.960784, 1)#
Lavender blush color.
const LAWN_GREEN = Color(0.486275, 0.988235, 0, 1)#
Lawn green color.
const LEMON_CHIFFON = Color(1, 0.980392, 0.803922, 1)#
Lemon chiffon color.
const LIGHT_BLUE = Color(0.678431, 0.847059, 0.901961, 1)#
Light blue color.
const LIGHT_CORAL = Color(0.941176, 0.501961, 0.501961, 1)#
Light coral color.
const LIGHT_CYAN = Color(0.878431, 1, 1, 1)#
Light cyan color.
const LIGHT_GOLDENROD = Color(0.980392, 0.980392, 0.823529, 1)#
Light goldenrod color.
const LIGHT_GRAY = Color(0.827451, 0.827451, 0.827451, 1)#
Light gray color.
const LIGHT_GREEN = Color(0.564706, 0.933333, 0.564706, 1)#
Light green color.
const LIGHT_PINK = Color(1, 0.713726, 0.756863, 1)#
Light pink color.
const LIGHT_SALMON = Color(1, 0.627451, 0.478431, 1)#
Light salmon color.
const LIGHT_SEA_GREEN = Color(0.12549, 0.698039, 0.666667, 1)#
Light sea green color.
const LIGHT_SKY_BLUE = Color(0.529412, 0.807843, 0.980392, 1)#
Light sky blue color.
const LIGHT_SLATE_GRAY = Color(0.466667, 0.533333, 0.6, 1)#
Light slate gray color.
const LIGHT_STEEL_BLUE = Color(0.690196, 0.768627, 0.870588, 1)#
Light steel blue color.
const LIGHT_YELLOW = Color(1, 1, 0.878431, 1)#
Light yellow color.
const LIME = Color(0, 1, 0, 1)#
Lime color.
const LIME_GREEN = Color(0.196078, 0.803922, 0.196078, 1)#
Lime green color.
const LINEN = Color(0.980392, 0.941176, 0.901961, 1)#
Linen color.
const MAGENTA = Color(1, 0, 1, 1)#
Magenta color.
const MAROON = Color(0.690196, 0.188235, 0.376471, 1)#
Maroon color.
const MEDIUM_AQUAMARINE = Color(0.4, 0.803922, 0.666667, 1)#
Medium aquamarine color.
const MEDIUM_BLUE = Color(0, 0, 0.803922, 1)#
Medium blue color.
const MEDIUM_ORCHID = Color(0.729412, 0.333333, 0.827451, 1)#
Medium orchid color.
const MEDIUM_PURPLE = Color(0.576471, 0.439216, 0.858824, 1)#
Medium purple color.
const MEDIUM_SEA_GREEN = Color(0.235294, 0.701961, 0.443137, 1)#
Medium sea green color.
const MEDIUM_SLATE_BLUE = Color(0.482353, 0.407843, 0.933333, 1)#
Medium slate blue color.
const MEDIUM_SPRING_GREEN = Color(0, 0.980392, 0.603922, 1)#
Medium spring green color.
const MEDIUM_TURQUOISE = Color(0.282353, 0.819608, 0.8, 1)#
Medium turquoise color.
const MEDIUM_VIOLET_RED = Color(0.780392, 0.0823529, 0.521569, 1)#
Medium violet red color.
const MIDNIGHT_BLUE = Color(0.0980392, 0.0980392, 0.439216, 1)#
Midnight blue color.
const MINT_CREAM = Color(0.960784, 1, 0.980392, 1)#
Mint cream color.
const MISTY_ROSE = Color(1, 0.894118, 0.882353, 1)#
Misty rose color.
const MOCCASIN = Color(1, 0.894118, 0.709804, 1)#
Moccasin color.
const NAVAJO_WHITE = Color(1, 0.870588, 0.678431, 1)#
Navajo white color.
const NAVY_BLUE = Color(0, 0, 0.501961, 1)#
Navy blue color.
const OLD_LACE = Color(0.992157, 0.960784, 0.901961, 1)#
Old lace color.
const OLIVE = Color(0.501961, 0.501961, 0, 1)#
Olive color.
const OLIVE_DRAB = Color(0.419608, 0.556863, 0.137255, 1)#
Olive drab color.
const ORANGE = Color(1, 0.647059, 0, 1)#
Orange color.
const ORANGE_RED = Color(1, 0.270588, 0, 1)#
Orange red color.
const ORCHID = Color(0.854902, 0.439216, 0.839216, 1)#
Orchid color.
const PALE_GOLDENROD = Color(0.933333, 0.909804, 0.666667, 1)#
Pale goldenrod color.
const PALE_GREEN = Color(0.596078, 0.984314, 0.596078, 1)#
Pale green color.
const PALE_TURQUOISE = Color(0.686275, 0.933333, 0.933333, 1)#
Pale turquoise color.
const PALE_VIOLET_RED = Color(0.858824, 0.439216, 0.576471, 1)#
Pale violet red color.
const PAPAYA_WHIP = Color(1, 0.937255, 0.835294, 1)#
Papaya whip color.
const PEACH_PUFF = Color(1, 0.854902, 0.72549, 1)#
Peach puff color.
const PERU = Color(0.803922, 0.521569, 0.247059, 1)#
Peru color.
const PINK = Color(1, 0.752941, 0.796078, 1)#
Pink color.
const PLUM = Color(0.866667, 0.627451, 0.866667, 1)#
Plum color.
const POWDER_BLUE = Color(0.690196, 0.878431, 0.901961, 1)#
Powder blue color.
const PURPLE = Color(0.627451, 0.12549, 0.941176, 1)#
Purple color.
const REBECCA_PURPLE = Color(0.4, 0.2, 0.6, 1)#
Rebecca purple color.
const RED = Color(1, 0, 0, 1)#
Red color.
const ROSY_BROWN = Color(0.737255, 0.560784, 0.560784, 1)#
Rosy brown color.
const ROYAL_BLUE = Color(0.254902, 0.411765, 0.882353, 1)#
Royal blue color.
const SADDLE_BROWN = Color(0.545098, 0.270588, 0.0745098, 1)#
Saddle brown color.
const SALMON = Color(0.980392, 0.501961, 0.447059, 1)#
Salmon color.
const SANDY_BROWN = Color(0.956863, 0.643137, 0.376471, 1)#
Sandy brown color.
const SEA_GREEN = Color(0.180392, 0.545098, 0.341176, 1)#
Sea green color.
const SEASHELL = Color(1, 0.960784, 0.933333, 1)#
Seashell color.
const SIENNA = Color(0.627451, 0.321569, 0.176471, 1)#
Sienna color.
const SILVER = Color(0.752941, 0.752941, 0.752941, 1)#
Silver color.
const SKY_BLUE = Color(0.529412, 0.807843, 0.921569, 1)#
Sky blue color.
const SLATE_BLUE = Color(0.415686, 0.352941, 0.803922, 1)#
Slate blue color.
const SLATE_GRAY = Color(0.439216, 0.501961, 0.564706, 1)#
Slate gray color.
const SNOW = Color(1, 0.980392, 0.980392, 1)#
Snow color.
const SPRING_GREEN = Color(0, 1, 0.498039, 1)#
Spring green color.
const STEEL_BLUE = Color(0.27451, 0.509804, 0.705882, 1)#
Steel blue color.
const TAN = Color(0.823529, 0.705882, 0.54902, 1)#
Tan color.
const TEAL = Color(0, 0.501961, 0.501961, 1)#
Teal color.
const THISTLE = Color(0.847059, 0.74902, 0.847059, 1)#
Thistle color.
const TOMATO = Color(1, 0.388235, 0.278431, 1)#
Tomato color.
const TRANSPARENT = Color(1, 1, 1, 0)#
Transparent color (white with zero alpha).
const TURQUOISE = Color(0.25098, 0.878431, 0.815686, 1)#
Turquoise color.
const VIOLET = Color(0.933333, 0.509804, 0.933333, 1)#
Violet color.
const WEB_GRAY = Color(0.501961, 0.501961, 0.501961, 1)#
Web gray color.
const WEB_GREEN = Color(0, 0.501961, 0, 1)#
Web green color.
const WEB_MAROON = Color(0.501961, 0, 0, 1)#
Web maroon color.
const WEB_PURPLE = Color(0.501961, 0, 0.501961, 1)#
Web purple color.
const WHEAT = Color(0.960784, 0.870588, 0.701961, 1)#
Wheat color.
const WHITE = Color(1, 1, 1, 1)#
White color.
const WHITE_SMOKE = Color(0.960784, 0.960784, 0.960784, 1)#
White smoke color.
const YELLOW = Color(1, 1, 0, 1)#
Yellow color.
const YELLOW_GREEN = Color(0.603922, 0.803922, 0.196078, 1)#
Yellow green color.
Constructors #
Color() -> Color #
Constructs a default Color from opaque black. This is the same as BLACK.
Note: In C#, this constructs a Color with all of its components set to 0.0 (transparent black).
Color(alpha: float) -> Color #
Constructs a Color from the existing color, with a set to the given alpha value.
GDScript
var red = Color(Color.RED, 0.2) # 20% opaque red.C#
var red = new Color(Colors.Red, 0.2f); // 20% opaque red.Color(from: Color) -> Color #
Constructs a Color as a copy of the given Color.
Color(code: String) -> Color #
Constructs a Color either from an HTML color code or from a standardized color name. The supported color names are the same as the constants.
Color(alpha: float) -> Color #
Constructs a Color either from an HTML color code or from a standardized color name, with alpha on the range of 0.0 to 1.0. The supported color names are the same as the constants.
Color(b: float) -> Color #
Constructs a Color from RGB values, typically between 0.0 and 1.0. a is set to 1.0.
GDScript
var color = Color(0.2, 1.0, 0.7) # Similar to `Color8(51, 255, 178, 255)`C#
var color = new Color(0.2f, 1.0f, 0.7f); // Similar to `Color.Color8(51, 255, 178, 255)`Color(a: float) -> Color #
Constructs a Color from RGBA values, typically between 0.0 and 1.0.
GDScript
var color = Color(0.2, 1.0, 0.7, 0.8) # Similar to `Color8(51, 255, 178, 204)`C#
var color = new Color(0.2f, 1.0f, 0.7f, 0.8f); // Similar to `Color.Color8(51, 255, 178, 255, 204)` Enums #
Notifications#
enum {
ALICE_BLUE = Color(0.941176, 0.972549, 1, 1),
ANTIQUE_WHITE = Color(0.980392, 0.921569, 0.843137, 1),
AQUA = Color(0, 1, 1, 1),
AQUAMARINE = Color(0.498039, 1, 0.831373, 1),
AZURE = Color(0.941176, 1, 1, 1),
BEIGE = Color(0.960784, 0.960784, 0.862745, 1),
BISQUE = Color(1, 0.894118, 0.768627, 1),
BLACK = Color(0, 0, 0, 1),
BLANCHED_ALMOND = Color(1, 0.921569, 0.803922, 1),
BLUE = Color(0, 0, 1, 1),
BLUE_VIOLET = Color(0.541176, 0.168627, 0.886275, 1),
BROWN = Color(0.647059, 0.164706, 0.164706, 1),
BURLYWOOD = Color(0.870588, 0.721569, 0.529412, 1),
CADET_BLUE = Color(0.372549, 0.619608, 0.627451, 1),
CHARTREUSE = Color(0.498039, 1, 0, 1),
CHOCOLATE = Color(0.823529, 0.411765, 0.117647, 1),
CORAL = Color(1, 0.498039, 0.313726, 1),
CORNFLOWER_BLUE = Color(0.392157, 0.584314, 0.929412, 1),
CORNSILK = Color(1, 0.972549, 0.862745, 1),
CRIMSON = Color(0.862745, 0.0784314, 0.235294, 1),
CYAN = Color(0, 1, 1, 1),
DARK_BLUE = Color(0, 0, 0.545098, 1),
DARK_CYAN = Color(0, 0.545098, 0.545098, 1),
DARK_GOLDENROD = Color(0.721569, 0.52549, 0.0431373, 1),
DARK_GRAY = Color(0.662745, 0.662745, 0.662745, 1),
DARK_GREEN = Color(0, 0.392157, 0, 1),
DARK_KHAKI = Color(0.741176, 0.717647, 0.419608, 1),
DARK_MAGENTA = Color(0.545098, 0, 0.545098, 1),
DARK_OLIVE_GREEN = Color(0.333333, 0.419608, 0.184314, 1),
DARK_ORANGE = Color(1, 0.54902, 0, 1),
DARK_ORCHID = Color(0.6, 0.196078, 0.8, 1),
DARK_RED = Color(0.545098, 0, 0, 1),
DARK_SALMON = Color(0.913725, 0.588235, 0.478431, 1),
DARK_SEA_GREEN = Color(0.560784, 0.737255, 0.560784, 1),
DARK_SLATE_BLUE = Color(0.282353, 0.239216, 0.545098, 1),
DARK_SLATE_GRAY = Color(0.184314, 0.309804, 0.309804, 1),
DARK_TURQUOISE = Color(0, 0.807843, 0.819608, 1),
DARK_VIOLET = Color(0.580392, 0, 0.827451, 1),
DEEP_PINK = Color(1, 0.0784314, 0.576471, 1),
DEEP_SKY_BLUE = Color(0, 0.74902, 1, 1),
DIM_GRAY = Color(0.411765, 0.411765, 0.411765, 1),
DODGER_BLUE = Color(0.117647, 0.564706, 1, 1),
FIREBRICK = Color(0.698039, 0.133333, 0.133333, 1),
FLORAL_WHITE = Color(1, 0.980392, 0.941176, 1),
FOREST_GREEN = Color(0.133333, 0.545098, 0.133333, 1),
FUCHSIA = Color(1, 0, 1, 1),
GAINSBORO = Color(0.862745, 0.862745, 0.862745, 1),
GHOST_WHITE = Color(0.972549, 0.972549, 1, 1),
GOLD = Color(1, 0.843137, 0, 1),
GOLDENROD = Color(0.854902, 0.647059, 0.12549, 1),
GRAY = Color(0.745098, 0.745098, 0.745098, 1),
GREEN = Color(0, 1, 0, 1),
GREEN_YELLOW = Color(0.678431, 1, 0.184314, 1),
HONEYDEW = Color(0.941176, 1, 0.941176, 1),
HOT_PINK = Color(1, 0.411765, 0.705882, 1),
INDIAN_RED = Color(0.803922, 0.360784, 0.360784, 1),
INDIGO = Color(0.294118, 0, 0.509804, 1),
IVORY = Color(1, 1, 0.941176, 1),
KHAKI = Color(0.941176, 0.901961, 0.54902, 1),
LAVENDER = Color(0.901961, 0.901961, 0.980392, 1),
LAVENDER_BLUSH = Color(1, 0.941176, 0.960784, 1),
LAWN_GREEN = Color(0.486275, 0.988235, 0, 1),
LEMON_CHIFFON = Color(1, 0.980392, 0.803922, 1),
LIGHT_BLUE = Color(0.678431, 0.847059, 0.901961, 1),
LIGHT_CORAL = Color(0.941176, 0.501961, 0.501961, 1),
LIGHT_CYAN = Color(0.878431, 1, 1, 1),
LIGHT_GOLDENROD = Color(0.980392, 0.980392, 0.823529, 1),
LIGHT_GRAY = Color(0.827451, 0.827451, 0.827451, 1),
LIGHT_GREEN = Color(0.564706, 0.933333, 0.564706, 1),
LIGHT_PINK = Color(1, 0.713726, 0.756863, 1),
LIGHT_SALMON = Color(1, 0.627451, 0.478431, 1),
LIGHT_SEA_GREEN = Color(0.12549, 0.698039, 0.666667, 1),
LIGHT_SKY_BLUE = Color(0.529412, 0.807843, 0.980392, 1),
LIGHT_SLATE_GRAY = Color(0.466667, 0.533333, 0.6, 1),
LIGHT_STEEL_BLUE = Color(0.690196, 0.768627, 0.870588, 1),
LIGHT_YELLOW = Color(1, 1, 0.878431, 1),
LIME = Color(0, 1, 0, 1),
LIME_GREEN = Color(0.196078, 0.803922, 0.196078, 1),
LINEN = Color(0.980392, 0.941176, 0.901961, 1),
MAGENTA = Color(1, 0, 1, 1),
MAROON = Color(0.690196, 0.188235, 0.376471, 1),
MEDIUM_AQUAMARINE = Color(0.4, 0.803922, 0.666667, 1),
MEDIUM_BLUE = Color(0, 0, 0.803922, 1),
MEDIUM_ORCHID = Color(0.729412, 0.333333, 0.827451, 1),
MEDIUM_PURPLE = Color(0.576471, 0.439216, 0.858824, 1),
MEDIUM_SEA_GREEN = Color(0.235294, 0.701961, 0.443137, 1),
MEDIUM_SLATE_BLUE = Color(0.482353, 0.407843, 0.933333, 1),
MEDIUM_SPRING_GREEN = Color(0, 0.980392, 0.603922, 1),
MEDIUM_TURQUOISE = Color(0.282353, 0.819608, 0.8, 1),
MEDIUM_VIOLET_RED = Color(0.780392, 0.0823529, 0.521569, 1),
MIDNIGHT_BLUE = Color(0.0980392, 0.0980392, 0.439216, 1),
MINT_CREAM = Color(0.960784, 1, 0.980392, 1),
MISTY_ROSE = Color(1, 0.894118, 0.882353, 1),
MOCCASIN = Color(1, 0.894118, 0.709804, 1),
NAVAJO_WHITE = Color(1, 0.870588, 0.678431, 1),
NAVY_BLUE = Color(0, 0, 0.501961, 1),
OLD_LACE = Color(0.992157, 0.960784, 0.901961, 1),
OLIVE = Color(0.501961, 0.501961, 0, 1),
OLIVE_DRAB = Color(0.419608, 0.556863, 0.137255, 1),
ORANGE = Color(1, 0.647059, 0, 1),
ORANGE_RED = Color(1, 0.270588, 0, 1),
ORCHID = Color(0.854902, 0.439216, 0.839216, 1),
PALE_GOLDENROD = Color(0.933333, 0.909804, 0.666667, 1),
PALE_GREEN = Color(0.596078, 0.984314, 0.596078, 1),
PALE_TURQUOISE = Color(0.686275, 0.933333, 0.933333, 1),
PALE_VIOLET_RED = Color(0.858824, 0.439216, 0.576471, 1),
PAPAYA_WHIP = Color(1, 0.937255, 0.835294, 1),
PEACH_PUFF = Color(1, 0.854902, 0.72549, 1),
PERU = Color(0.803922, 0.521569, 0.247059, 1),
PINK = Color(1, 0.752941, 0.796078, 1),
PLUM = Color(0.866667, 0.627451, 0.866667, 1),
POWDER_BLUE = Color(0.690196, 0.878431, 0.901961, 1),
PURPLE = Color(0.627451, 0.12549, 0.941176, 1),
REBECCA_PURPLE = Color(0.4, 0.2, 0.6, 1),
RED = Color(1, 0, 0, 1),
ROSY_BROWN = Color(0.737255, 0.560784, 0.560784, 1),
ROYAL_BLUE = Color(0.254902, 0.411765, 0.882353, 1),
SADDLE_BROWN = Color(0.545098, 0.270588, 0.0745098, 1),
SALMON = Color(0.980392, 0.501961, 0.447059, 1),
SANDY_BROWN = Color(0.956863, 0.643137, 0.376471, 1),
SEA_GREEN = Color(0.180392, 0.545098, 0.341176, 1),
SEASHELL = Color(1, 0.960784, 0.933333, 1),
SIENNA = Color(0.627451, 0.321569, 0.176471, 1),
SILVER = Color(0.752941, 0.752941, 0.752941, 1),
SKY_BLUE = Color(0.529412, 0.807843, 0.921569, 1),
SLATE_BLUE = Color(0.415686, 0.352941, 0.803922, 1),
SLATE_GRAY = Color(0.439216, 0.501961, 0.564706, 1),
SNOW = Color(1, 0.980392, 0.980392, 1),
SPRING_GREEN = Color(0, 1, 0.498039, 1),
STEEL_BLUE = Color(0.27451, 0.509804, 0.705882, 1),
TAN = Color(0.823529, 0.705882, 0.54902, 1),
TEAL = Color(0, 0.501961, 0.501961, 1),
THISTLE = Color(0.847059, 0.74902, 0.847059, 1),
TOMATO = Color(1, 0.388235, 0.278431, 1),
TRANSPARENT = Color(1, 1, 1, 0),
TURQUOISE = Color(0.25098, 0.878431, 0.815686, 1),
VIOLET = Color(0.933333, 0.509804, 0.933333, 1),
WEB_GRAY = Color(0.501961, 0.501961, 0.501961, 1),
WEB_GREEN = Color(0, 0.501961, 0, 1),
WEB_MAROON = Color(0.501961, 0, 0, 1),
WEB_PURPLE = Color(0.501961, 0, 0.501961, 1),
WHEAT = Color(0.960784, 0.870588, 0.701961, 1),
WHITE = Color(1, 1, 1, 1),
WHITE_SMOKE = Color(0.960784, 0.960784, 0.960784, 1),
YELLOW = Color(1, 1, 0, 1),
YELLOW_GREEN = Color(0.603922, 0.803922, 0.196078, 1),
}Operators #
Color != Color -> bool#
Returns true if the colors are not exactly equal.
Note: Due to floating-point precision errors, consider using is_equal_approx instead, which is more reliable.
Color * Color -> Color#
Multiplies each component of the Color by the components of the given Color.
Color * float -> Color#
Multiplies each component of the Color by the given float.
Color * int -> Color#
Multiplies each component of the Color by the given int.
Color + Color -> Color#
Adds each component of the Color with the components of the given Color.
Color - Color -> Color#
Subtracts each component of the Color by the components of the given Color.
Color / Color -> Color#
Divides each component of the Color by the components of the given Color.
Color / float -> Color#
Divides each component of the Color by the given float.
Color / int -> Color#
Divides each component of the Color by the given int.
Color == Color -> bool#
Returns true if the colors are exactly equal.
Note: Due to floating-point precision errors, consider using is_equal_approx instead, which is more reliable.
Color[int] -> float#
Access color components using their index. 0 is equivalent to r, 1 is equivalent to g, 2 is equivalent to b, and 3 is equivalent to a.
+Color -> Color#
Returns the same value as if the + was not there. Unary + does nothing, but sometimes it can make your code more readable.
-Color -> Color#
Inverts the given color. This is equivalent to Color.WHITE - c or Color(1 - c.r, 1 - c.g, 1 - c.b, 1 - c.a). Unlike with inverted, the a component is inverted, too.