Color Conversion
Expressions to convert color values between various formats (RGB, HSV, HSL, named colors), calculate luminance according to WCAG 2.0 standards, and to blend two colors.
Authors and contributors to this community extension: VictrisGames, Add00, D8H, Ahnaf30e.
Expressions to convert color values between various formats (RGB, HSV, HSL, named colors), calculate luminance according to WCAG 2.0 standards, and to blend two colors.
Tip
Learn how to install new extensions by following a step-by-step guide.
Expressions
Expression | Description | |
---|---|---|
ColorConversion::HexToLuminance(string) |
Calculate luminance of a hexadecimal color. Example input: "0459AF". | |
string | Hex value | |
ColorConversion::HexToRgb(color) |
Converts a hexadecimal string into a RGB string. Example input: "0459AF". | |
color | Hex value | |
ColorConversion::HslToRgb(number, number, number) |
Converts HSL color values into a RGB string. Valid input ranges: H(0 to 360), S(0 to 100), L(0 to 100). | |
🔢 Number | Hue 0-360 | |
🔢 Number | Saturation 0-100 | |
🔢 Number | Lightness 0-100 | |
ColorConversion::HsvToRgb(number, number, number) |
Converts HSV color values into a RGB string. Valid input ranges: H(0 to 360), S(0 to 100), V(0 to 100). | |
🔢 Number | Hue 0-360 | |
🔢 Number | Saturation 0-100 | |
🔢 Number | Value 0-100 | |
ColorConversion::HueToRgb(number) |
Converts a color hue (range: 0 to 360) into an RGB color string with 100% saturation and 50% lightness. | |
🔢 Number | Hue 0-360 | |
ColorConversion::NameToRgb(color) |
Converts a color name into a RGB string. (Examples: black, gray, white, red, purple, green, yellow, blue) Full list of colors: https://www.w3schools.com/colors/colors_names.asp. | |
color | Name of a color | |
ColorConversion::RgbMean(color, color, number) |
Blend two RGB colors by applying a weighted mean. | |
color | First RGB color | |
color | Second RGB color | |
🔢 Number | Ratio Range: 0 to 1, where 0 gives the first color and 1 gives the second color | |
ColorConversion::RgbToHex(color) |
Converts a RGB string into a hexadecimal string. Example input: "0;128;255". | |
color | RGB value | |
ColorConversion::RgbToHsl(color) |
Converts a RGB string into a HSL string. Example input: "0;128;255"". | |
color | RGB value | |
ColorConversion::RgbToHsv(color) |
Converts a RGB string into a HSV string. Example input: "0;128;255". | |
color | RGB value | |
ColorConversion::RgbToLuminance(color) |
Calculate luminance of a RGB color. Example input: "0;128;255". | |
color | RGB color |
This page is an auto-generated reference page about the Color Conversion extension, made by the community of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop community-made extensions here.