Color in RGBA format using floats on the range of 0 to 1. A color represented by red, green, blue, and alpha (RGBA) components. The alpha component is often used for transparency. Values are in floating-point and usually range from 0 to 1. Some properties (such as CanvasItem.modulate) may accept values greater than 1 (overbright or HDR colors). You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8]. [b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code]. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/color_constants.png]Color constants cheatsheet[/url] https://godotengine.org/asset-library/asset/517 https://godotengine.org/asset-library/asset/146 https://godotengine.org/asset-library/asset/133 Constructs a color from an HTML hexadecimal color string in RGB or RGBA format. See also [method @GDScript.ColorN]. [codeblocks] [gdscript] # Each of the following creates the same color RGBA(178, 217, 10, 255). var c3 = Color("#b2d90a") # RGB format with "#". var c4 = Color("b2d90a") # RGB format. var c1 = Color("#b2d90aff") # RGBA format with "#". var c2 = Color("b2d90aff") # RGBA format. [/gdscript] [csharp] // Each of the following creates the same color RGBA(178, 217, 10, 255). var c3 = new Color("#b2d90a"); var c4 = new Color("b2d90a"); // RGB format. var c1 = new Color("#b2d90aff"); var c2 = new Color("b2d90aff"); // RGBA format. [/csharp] [/codeblocks] You can also use the "web color" short-hand form by only using 3 or 4 digits. [codeblocks] [gdscript] # Each of the following creates the same color RGBA(17, 34, 51, 255). var c3 = Color("#123") # RGB format with "#". var c4 = Color("123") # RGB format. var c1 = Color("#123f") # RGBA format with "#". var c2 = Color("123f") # RGBA format. [/gdscript] [csharp] // Each of the following creates the same color RGBA(17, 34, 51, 255). var c3 = new Color("#123"); var c4 = new Color("123"); // RGB format. var c1 = new Color("#123f"); var c2 = new Color("123f"); // RGBA format. [/csharp] [/codeblocks] Constructs a color from a 32-bit integer (each byte represents a component of the RGBA profile). [codeblocks] [gdscript] var c = Color(274) # Equivalent to RGBA(0, 0, 1, 18) [/gdscript] [csharp] var c = new Color(274); // Equivalent to RGBA(0, 0, 1, 18) [/csharp] [/codeblocks] Constructs a color from an existing color, but with a custom alpha value. [codeblocks] [gdscript] var red = Color(Color.red, 0.5) # 50% transparent red. [/gdscript] [csharp] var red = new Color(Colors.Red, 0.5f); // 50% transparent red. [/csharp] [/codeblocks] Constructs a color from an RGB profile using values between 0 and 1. Alpha will always be 1. [codeblocks] [gdscript] var color = Color(0.2, 1.0, 0.7) # Equivalent to RGBA(51, 255, 178, 255) [/gdscript] [csharp] var color = new Color(0.2f, 1.0f, 0.7f); // Equivalent to RGBA(51, 255, 178, 255) [/csharp] [/codeblocks] Constructs a color from an RGBA profile using values between 0 and 1. [codeblocks] [gdscript] var color = Color(0.2, 1.0, 0.7, 0.8) # Equivalent to RGBA(51, 255, 178, 204) [/gdscript] [csharp] var color = new Color(0.2f, 1.0f, 0.7f, 0.8f); // Equivalent to RGBA(51, 255, 178, 255, 204) [/csharp] [/codeblocks] 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. [codeblocks] [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% [/gdscript] [csharp] 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% [/csharp] [/codeblocks] Returns the most contrasting color. [codeblocks] [gdscript] var color = Color(0.3, 0.4, 0.9) var contrasted_color = color.contrasted() # Equivalent to RGBA(204, 229, 102, 255) [/gdscript] [csharp] var color = new Color(0.3f, 0.4f, 0.9f); Color contrastedColor = color.Contrasted(); // Equivalent to RGBA(204, 229, 102, 255) [/csharp] [/codeblocks] Returns a new color resulting from making this color darker by the specified percentage (ratio from 0 to 1). [codeblocks] [gdscript] var green = Color(0.0, 1.0, 0.0) var darkgreen = green.darkened(0.2) # 20% darker than regular green [/gdscript] [csharp] var green = new Color(0.0f, 1.0f, 0.0f); Color darkgreen = green.Darkened(0.2f); // 20% darker than regular green [/csharp] [/codeblocks] Returns the inverted color [code](1 - r, 1 - g, 1 - b, a)[/code]. [codeblocks] [gdscript] var color = Color(0.3, 0.4, 0.9) var inverted_color = color.inverted() # A color of an RGBA(178, 153, 26, 255) [/gdscript] [csharp] var color = new Color(0.3f, 0.4f, 0.9f); Color invertedColor = color.Inverted(); // A color of an RGBA(178, 153, 26, 255) [/csharp] [/codeblocks] Returns [code]true[/code] if this color and [code]color[/code] are approximately equal, by running [method @GDScript.is_equal_approx] on each component. Returns the linear interpolation with another color. The interpolation factor [code]t[/code] is between 0 and 1. [codeblocks] [gdscript] var c1 = Color(1.0, 0.0, 0.0) var c2 = Color(0.0, 1.0, 0.0) var lerp_color = c1.lerp(c2, 0.5) # A color of an RGBA(128, 128, 0, 255) [/gdscript] [csharp] var c1 = new Color(1.0f, 0.0f, 0.0f); var c2 = new Color(0.0f, 1.0f, 0.0f); Color lerpColor = c1.Lerp(c2, 0.5f); // A color of an RGBA(128, 128, 0, 255) [/csharp] [/codeblocks] Returns a new color resulting from making this color lighter by the specified percentage (ratio from 0 to 1). [codeblocks] [gdscript] var green = Color(0.0, 1.0, 0.0) var lightgreen = green.lightened(0.2) # 20% lighter than regular green [/gdscript] [csharp] var green = new Color(0.0f, 1.0f, 0.0f); Color lightgreen = green.Lightened(0.2f); // 20% lighter than regular green [/csharp] [/codeblocks] Returns the color's 32-bit integer in ABGR format (each byte represents a component of the ABGR profile). ABGR is the reversed version of the default format. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) print(color.to_abgr32()) # Prints 4281565439 [/gdscript] [csharp] var color = new Color(1.0f, 0.5f, 0.2f); GD.Print(color.ToAbgr32()); // Prints 4281565439 [/csharp] [/codeblocks] Returns the color's 64-bit integer in ABGR format (each word represents a component of the ABGR profile). ABGR is the reversed version of the default format. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) print(color.to_abgr64()) # Prints -225178692812801 [/gdscript] [csharp] var color = new Color(1.0f, 0.5f, 0.2f); GD.Print(color.ToAbgr64()); // Prints -225178692812801 [/csharp] [/codeblocks] Returns the color's 32-bit integer in ARGB format (each byte represents a component of the ARGB profile). ARGB is more compatible with DirectX. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) print(color.to_argb32()) # Prints 4294934323 [/gdscript] [csharp] var color = new Color(1.0f, 0.5f, 0.2f); GD.Print(color.ToArgb32()); // Prints 4294934323 [/csharp] [/codeblocks] Returns the color's 64-bit integer in ARGB format (each word represents a component of the ARGB profile). ARGB is more compatible with DirectX. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) print(color.to_argb64()) # Prints -2147470541 [/gdscript] [csharp] var color = new Color(1.0f, 0.5f, 0.2f); GD.Print(color.ToArgb64()); // Prints -2147470541 [/csharp] [/codeblocks] Returns the color's HTML hexadecimal color string in RGBA format (ex: [code]ff34f822[/code]). Setting [code]with_alpha[/code] to [code]false[/code] excludes alpha from the hexadecimal string (and uses RGB instead of RGBA format). [codeblocks] [gdscript] var color = Color(1, 1, 1, 0.5) var with_alpha = color.to_html() # Returns "ffffff7f" var without_alpha = color.to_html(false) # Returns "ffffff" [/gdscript] [csharp] var color = new Color(1, 1, 1, 0.5f); String withAlpha = color.ToHtml(); // Returns "ffffff7f" String withoutAlpha = color.ToHtml(false); // Returns "ffffff" [/csharp] [/codeblocks] Returns the color's 32-bit integer in RGBA format (each byte represents a component of the RGBA profile). RGBA is Godot's default format. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) print(color.to_rgba32()) # Prints 4286526463 [/gdscript] [csharp] var color = new Color(1, 0.5f, 0.2f); GD.Print(color.ToRgba32()); // Prints 4286526463 [/csharp] [/codeblocks] Returns the color's 64-bit integer in RGBA format (each word represents a component of the RGBA profile). RGBA is Godot's default format. [codeblocks] [gdscript] var color = Color(1, 0.5, 0.2) print(color.to_rgba64()) # Prints -140736629309441 [/gdscript] [csharp] var color = new Color(1, 0.5f, 0.2f); GD.Print(color.ToRgba64()); // Prints -140736629309441 [/csharp] [/codeblocks] The color's alpha (transparency) component, typically on the range of 0 to 1. Wrapper for [member a] that uses the range 0 to 255 instead of 0 to 1. The color's blue component, typically on the range of 0 to 1. Wrapper for [member b] that uses the range 0 to 255 instead of 0 to 1. The color's green component, typically on the range of 0 to 1. Wrapper for [member g] that uses the range 0 to 255 instead of 0 to 1. The HSV hue of this color, on the range 0 to 1. The color's red component, typically on the range of 0 to 1. Wrapper for [member r] that uses the range 0 to 255 instead of 0 to 1. The HSV saturation of this color, on the range 0 to 1. The HSV value (brightness) of this color, on the range 0 to 1. Alice blue color. Antique white color. Aqua color. Aquamarine color. Azure color. Beige color. Bisque color. Black color. Blanche almond color. Blue color. Blue violet color. Brown color. Burly wood color. Cadet blue color. Chartreuse color. Chocolate color. Coral color. Cornflower color. Corn silk color. Crimson color. Cyan color. Dark blue color. Dark cyan color. Dark goldenrod color. Dark gray color. Dark green color. Dark khaki color. Dark magenta color. Dark olive green color. Dark orange color. Dark orchid color. Dark red color. Dark salmon color. Dark sea green color. Dark slate blue color. Dark slate gray color. Dark turquoise color. Dark violet color. Deep pink color. Deep sky blue color. Dim gray color. Dodger blue color. Firebrick color. Floral white color. Forest green color. Fuchsia color. Gainsboro color. Ghost white color. Gold color. Goldenrod color. Gray color. Green color. Green yellow color. Honeydew color. Hot pink color. Indian red color. Indigo color. Ivory color. Khaki color. Lavender color. Lavender blush color. Lawn green color. Lemon chiffon color. Light blue color. Light coral color. Light cyan color. Light goldenrod color. Light gray color. Light green color. Light pink color. Light salmon color. Light sea green color. Light sky blue color. Light slate gray color. Light steel blue color. Light yellow color. Lime color. Lime green color. Linen color. Magenta color. Maroon color. Medium aquamarine color. Medium blue color. Medium orchid color. Medium purple color. Medium sea green color. Medium slate blue color. Medium spring green color. Medium turquoise color. Medium violet red color. Midnight blue color. Mint cream color. Misty rose color. Moccasin color. Navajo white color. Navy blue color. Old lace color. Olive color. Olive drab color. Orange color. Orange red color. Orchid color. Pale goldenrod color. Pale green color. Pale turquoise color. Pale violet red color. Papaya whip color. Peach puff color. Peru color. Pink color. Plum color. Powder blue color. Purple color. Rebecca purple color. Red color. Rosy brown color. Royal blue color. Saddle brown color. Salmon color. Sandy brown color. Sea green color. Seashell color. Sienna color. Silver color. Sky blue color. Slate blue color. Slate gray color. Snow color. Spring green color. Steel blue color. Tan color. Teal color. Thistle color. Tomato color. Transparent color (white with no alpha). Turquoise color. Violet color. Web gray color. Web green color. Web maroon color. Web purple color. Wheat color. White color. White smoke color. Yellow color. Yellow green color.