Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename color constants #41019

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ed9cdc5
Correct C# named color constants
Aug 4, 2020
e0dedf8
Correct C++ named colors
Aug 4, 2020
4e1e13e
Correct Color GDScript docs
Aug 4, 2020
3b11808
Add the pedantic versions of color names
Aug 4, 2020
c37a4df
Update, per suggestions to stick with .NET, X11, HTML5 schemes
Aug 4, 2020
530e98d
Replace the weird comment
Aug 5, 2020
65d3e2e
Arrange entries in lexicographic order
Aug 5, 2020
bd709b4
Replace with UPPERCASE_NAMES
Aug 5, 2020
0b0617e
Separate UPPERCASE_NAMES map for sole use in _VariantCall
Aug 5, 2020
7458a37
Acknowledge Microsoft .NET docs
Aug 5, 2020
c5992d9
Implement new normalisation, change back _VariantCall, remove old names
Aug 5, 2020
502186e
Remove commented code from color.cpp
Aug 13, 2020
b23e333
Implement _to_uppercase_name for transforming normalised names to UPP…
Aug 13, 2020
479201d
Fix wrong index
Aug 13, 2020
814aa76
Rename append -> insert
Aug 13, 2020
2c5d7d9
Use Godot Vectors
Aug 13, 2020
534d434
Debug using print
Aug 13, 2020
d8ce60c
Debug using prints
Aug 13, 2020
d098dc1
Correct implementation
Aug 13, 2020
1059469
Make alpha of "transparent: a float literal
Aug 13, 2020
63526de
Separate the transformation code to a new .inc file to prevent linker…
Aug 16, 2020
2f3f285
Add deepksyblue as an edge case
Aug 16, 2020
f63dab2
Make _to_uppercase_name() static as intended
Aug 16, 2020
ec06353
Add descriptive comments and remove Vectors
Nov 15, 2020
b321a2f
Merge pull request #1 from godotengine/master
Nov 15, 2020
85312e9
Merge branch 'master' of https://github.com/ShivamMukherjee/godot
Nov 15, 2020
50fb362
Adopt changes with new code organisation
Nov 15, 2020
d2033a2
Remove to_lower transformation
Nov 15, 2020
acd7168
Remove transformation code
Nov 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 150 additions & 1 deletion core/color_names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ static void _populate_named_colors() {
_named_colors.insert("chartreuse", Color(0.50, 1.00, 0.00));
_named_colors.insert("chocolate", Color(0.82, 0.41, 0.12));
_named_colors.insert("coral", Color(1.00, 0.50, 0.31));
_named_colors.insert("cornflower", Color(0.39, 0.58, 0.93));
_named_colors.insert("cornflower", Color(0.39, 0.58, 0.93)); // for compatibility
_named_colors.insert("cornflowerblue", Color(0.39, 0.58, 0.93));
Vivraan marked this conversation as resolved.
Show resolved Hide resolved
_named_colors.insert("cornsilk", Color(1.00, 0.97, 0.86));
_named_colors.insert("crimson", Color(0.86, 0.08, 0.24));
_named_colors.insert("cyan", Color(0.00, 1.00, 1.00));
Expand Down Expand Up @@ -152,4 +153,152 @@ static void _populate_named_colors() {
_named_colors.insert("whitesmoke", Color(0.96, 0.96, 0.96));
_named_colors.insert("yellow", Color(1.00, 1.00, 0.00));
_named_colors.insert("yellowgreen", Color(0.60, 0.80, 0.20));

// You're a pedant
Vivraan marked this conversation as resolved.
Show resolved Hide resolved
_named_colors.insert("ALICE_BLUE", Color(0.94, 0.97, 1.00));
_named_colors.insert("ANTIQUE_WHITE", Color(0.98, 0.92, 0.84));
_named_colors.insert("AQUA", Color(0.00, 1.00, 1.00));
_named_colors.insert("AQUAMARINE", Color(0.50, 1.00, 0.83));
_named_colors.insert("AZURE", Color(0.94, 1.00, 1.00));
_named_colors.insert("BEIGE", Color(0.96, 0.96, 0.86));
_named_colors.insert("BISQUE", Color(1.00, 0.89, 0.77));
_named_colors.insert("BLACK", Color(0.00, 0.00, 0.00));
_named_colors.insert("BLANCHED_ALMOND", Color(1.00, 0.92, 0.80));
_named_colors.insert("BLUE", Color(0.00, 0.00, 1.00));
_named_colors.insert("BLUE_VIOLET", Color(0.54, 0.17, 0.89));
_named_colors.insert("BROWN", Color(0.65, 0.16, 0.16));
_named_colors.insert("BURLYWOOD", Color(0.87, 0.72, 0.53));
_named_colors.insert("CADET_BLUE", Color(0.37, 0.62, 0.63));
_named_colors.insert("CHARTREUSE", Color(0.50, 1.00, 0.00));
_named_colors.insert("CHOCOLATE", Color(0.82, 0.41, 0.12));
_named_colors.insert("CORAL", Color(1.00, 0.50, 0.31));
_named_colors.insert("CORNFLOWER_BLUE", Color(0.39, 0.58, 0.93));
_named_colors.insert("CORNSILK", Color(1.00, 0.97, 0.86));
_named_colors.insert("CRIMSON", Color(0.86, 0.08, 0.24));
_named_colors.insert("CYAN", Color(0.00, 1.00, 1.00));
_named_colors.insert("DARK_BLUE", Color(0.00, 0.00, 0.55));
_named_colors.insert("DARK_CYAN", Color(0.00, 0.55, 0.55));
_named_colors.insert("DARK_GOLDENROD", Color(0.72, 0.53, 0.04));
_named_colors.insert("DARK_GRAY", Color(0.66, 0.66, 0.66));
_named_colors.insert("DARK_GREEN", Color(0.00, 0.39, 0.00));
_named_colors.insert("DARK_KHAKI", Color(0.74, 0.72, 0.42));
_named_colors.insert("DARK_MAGENTA", Color(0.55, 0.00, 0.55));
_named_colors.insert("DARK_OLIVE_GREEN", Color(0.33, 0.42, 0.18));
_named_colors.insert("DARK_ORANGE", Color(1.00, 0.55, 0.00));
_named_colors.insert("DARK_ORCHID", Color(0.60, 0.20, 0.80));
_named_colors.insert("DARK_RED", Color(0.55, 0.00, 0.00));
_named_colors.insert("DARK_SALMON", Color(0.91, 0.59, 0.48));
_named_colors.insert("DARK_SEA_GREEN", Color(0.56, 0.74, 0.56));
_named_colors.insert("DARK_SLATE_BLUE", Color(0.28, 0.24, 0.55));
_named_colors.insert("DARK_SLATE_GRAY", Color(0.18, 0.31, 0.31));
_named_colors.insert("DARK_TURQUOISE", Color(0.00, 0.81, 0.82));
_named_colors.insert("DARK_VIOLET", Color(0.58, 0.00, 0.83));
_named_colors.insert("DEEP_PINK", Color(1.00, 0.08, 0.58));
_named_colors.insert("DEEP_SKY_BLUE", Color(0.00, 0.75, 1.00));
_named_colors.insert("DIM_GRAY", Color(0.41, 0.41, 0.41));
_named_colors.insert("DODGER_BLUE", Color(0.12, 0.56, 1.00));
_named_colors.insert("FIREBRICK", Color(0.70, 0.13, 0.13));
_named_colors.insert("FLORAL_WHITE", Color(1.00, 0.98, 0.94));
_named_colors.insert("FOREST_GREEN", Color(0.13, 0.55, 0.13));
_named_colors.insert("FUCHSIA", Color(1.00, 0.00, 1.00));
_named_colors.insert("GAINSBORO", Color(0.86, 0.86, 0.86));
_named_colors.insert("GHOST_WHITE", Color(0.97, 0.97, 1.00));
_named_colors.insert("GOLD", Color(1.00, 0.84, 0.00));
_named_colors.insert("GOLDENROD", Color(0.85, 0.65, 0.13));
_named_colors.insert("GRAY", Color(0.75, 0.75, 0.75));
_named_colors.insert("WEB_GRAY", Color(0.50, 0.50, 0.50));
_named_colors.insert("GREEN", Color(0.00, 1.00, 0.00));
_named_colors.insert("WEB_GREEN", Color(0.00, 0.50, 0.00));
_named_colors.insert("GREEN_YELLOW", Color(0.68, 1.00, 0.18));
_named_colors.insert("HONEYDEW", Color(0.94, 1.00, 0.94));
_named_colors.insert("HOT_PINK", Color(1.00, 0.41, 0.71));
_named_colors.insert("INDIAN_RED", Color(0.80, 0.36, 0.36));
_named_colors.insert("INDIGO", Color(0.29, 0.00, 0.51));
_named_colors.insert("IVORY", Color(1.00, 1.00, 0.94));
_named_colors.insert("KHAKI", Color(0.94, 0.90, 0.55));
_named_colors.insert("LAVENDER", Color(0.90, 0.90, 0.98));
_named_colors.insert("LAVENDER_BLUSH", Color(1.00, 0.94, 0.96));
_named_colors.insert("LAWN_GREEN", Color(0.49, 0.99, 0.00));
_named_colors.insert("LEMON_CHIFFON", Color(1.00, 0.98, 0.80));
_named_colors.insert("LIGHT_BLUE", Color(0.68, 0.85, 0.90));
_named_colors.insert("LIGHT_CORAL", Color(0.94, 0.50, 0.50));
_named_colors.insert("LIGHT_CYAN", Color(0.88, 1.00, 1.00));
_named_colors.insert("LIGHT_GOLDENROD", Color(0.98, 0.98, 0.82));
_named_colors.insert("LIGHT_GRAY", Color(0.83, 0.83, 0.83));
_named_colors.insert("LIGHT_GREEN", Color(0.56, 0.93, 0.56));
_named_colors.insert("LIGHT_PINK", Color(1.00, 0.71, 0.76));
_named_colors.insert("LIGHT_SALMON", Color(1.00, 0.63, 0.48));
_named_colors.insert("LIGHT_SEA_GREEN", Color(0.13, 0.70, 0.67));
_named_colors.insert("LIGHT_SKY_BLUE", Color(0.53, 0.81, 0.98));
_named_colors.insert("LIGHT_SLATE_GRAY", Color(0.47, 0.53, 0.60));
_named_colors.insert("LIGHT_STEEL_BLUE", Color(0.69, 0.77, 0.87));
_named_colors.insert("LIGHT_YELLOW", Color(1.00, 1.00, 0.88));
_named_colors.insert("LIME", Color(0.00, 1.00, 0.00));
_named_colors.insert("LIME_GREEN", Color(0.20, 0.80, 0.20));
_named_colors.insert("LINEN", Color(0.98, 0.94, 0.90));
_named_colors.insert("MAGENTA", Color(1.00, 0.00, 1.00));
_named_colors.insert("MAROON", Color(0.69, 0.19, 0.38));
_named_colors.insert("WEB_MAROON", Color(0.50, 0.00, 0.00));
_named_colors.insert("MEDIUM_AQUAMARINE", Color(0.40, 0.80, 0.67));
_named_colors.insert("MEDIUM_BLUE", Color(0.00, 0.00, 0.80));
_named_colors.insert("MEDIUM_ORCHID", Color(0.73, 0.33, 0.83));
_named_colors.insert("MEDIUM_PURPLE", Color(0.58, 0.44, 0.86));
_named_colors.insert("MEDIUM_SEA_GREEN", Color(0.24, 0.70, 0.44));
_named_colors.insert("MEDIUM_SLATE_BLUE", Color(0.48, 0.41, 0.93));
_named_colors.insert("MEDIUM_SPRING_GREEN", Color(0.00, 0.98, 0.60));
_named_colors.insert("MEDIUM_TURQUOISE", Color(0.28, 0.82, 0.80));
_named_colors.insert("MEDIUM_VIOLET_RED", Color(0.78, 0.08, 0.52));
_named_colors.insert("MIDNIGHT_BLUE", Color(0.10, 0.10, 0.44));
_named_colors.insert("MINT_CREAM", Color(0.96, 1.00, 0.98));
_named_colors.insert("MISTY_ROSE", Color(1.00, 0.89, 0.88));
_named_colors.insert("MOCCASIN", Color(1.00, 0.89, 0.71));
_named_colors.insert("NAVAJO_WHITE", Color(1.00, 0.87, 0.68));
_named_colors.insert("NAVY_BLUE", Color(0.00, 0.00, 0.50));
_named_colors.insert("OLD_LACE", Color(0.99, 0.96, 0.90));
_named_colors.insert("OLIVE", Color(0.50, 0.50, 0.00));
_named_colors.insert("OLIVE_DRAB", Color(0.42, 0.56, 0.14));
_named_colors.insert("ORANGE", Color(1.00, 0.65, 0.00));
_named_colors.insert("ORANGE_RED", Color(1.00, 0.27, 0.00));
_named_colors.insert("ORCHID", Color(0.85, 0.44, 0.84));
_named_colors.insert("PALE_GOLDENROD", Color(0.93, 0.91, 0.67));
_named_colors.insert("PALE_GREEN", Color(0.60, 0.98, 0.60));
_named_colors.insert("PALE_TURQUOISE", Color(0.69, 0.93, 0.93));
_named_colors.insert("PALE_VIOLETRED", Color(0.86, 0.44, 0.58));
_named_colors.insert("PAPAYA_WHIP", Color(1.00, 0.94, 0.84));
_named_colors.insert("PEACH_PUFF", Color(1.00, 0.85, 0.73));
_named_colors.insert("PERU", Color(0.80, 0.52, 0.25));
_named_colors.insert("PINK", Color(1.00, 0.75, 0.80));
_named_colors.insert("PLUM", Color(0.87, 0.63, 0.87));
_named_colors.insert("POWDER_BLUE", Color(0.69, 0.88, 0.90));
_named_colors.insert("PURPLE", Color(0.63, 0.13, 0.94));
_named_colors.insert("WEB_PURPLE", Color(0.50, 0.00, 0.50));
_named_colors.insert("REBECCA_PURPLE", Color(0.40, 0.20, 0.60));
_named_colors.insert("RED", Color(1.00, 0.00, 0.00));
_named_colors.insert("ROSY_BROWN", Color(0.74, 0.56, 0.56));
_named_colors.insert("ROYAL_BLUE", Color(0.25, 0.41, 0.88));
_named_colors.insert("SADDLE_BROWN", Color(0.55, 0.27, 0.07));
_named_colors.insert("SALMON", Color(0.98, 0.50, 0.45));
_named_colors.insert("SANDY_BROWN", Color(0.96, 0.64, 0.38));
_named_colors.insert("SEA_GREEN", Color(0.18, 0.55, 0.34));
_named_colors.insert("SEASHELL", Color(1.00, 0.96, 0.93));
_named_colors.insert("SIENNA", Color(0.63, 0.32, 0.18));
_named_colors.insert("SILVER", Color(0.75, 0.75, 0.75));
_named_colors.insert("SKY_BLUE", Color(0.53, 0.81, 0.92));
_named_colors.insert("SLATE_BLUE", Color(0.42, 0.35, 0.80));
_named_colors.insert("SLATE_GRAY", Color(0.44, 0.50, 0.56));
_named_colors.insert("SNOW", Color(1.00, 0.98, 0.98));
_named_colors.insert("SPRING_GREEN", Color(0.00, 1.00, 0.50));
_named_colors.insert("STEEL_BLUE", Color(0.27, 0.51, 0.71));
_named_colors.insert("TAN", Color(0.82, 0.71, 0.55));
_named_colors.insert("TEAL", Color(0.00, 0.50, 0.50));
_named_colors.insert("THISTLE", Color(0.85, 0.75, 0.85));
_named_colors.insert("TOMATO", Color(1.00, 0.39, 0.28));
_named_colors.insert("TURQUOISE", Color(0.25, 0.88, 0.82));
_named_colors.insert("TRANSPARENT", Color(1.00, 1.00, 1.00, 0.00));
_named_colors.insert("VIOLET", Color(0.93, 0.51, 0.93));
_named_colors.insert("WHEAT", Color(0.96, 0.87, 0.70));
_named_colors.insert("WHITE", Color(1.00, 1.00, 1.00));
_named_colors.insert("WHITE_SMOKE", Color(0.96, 0.96, 0.96));
_named_colors.insert("YELLOW", Color(1.00, 1.00, 0.00));
_named_colors.insert("YELLOW_GREEN", Color(0.60, 0.80, 0.20));
}
8 changes: 4 additions & 4 deletions doc/classes/Color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
Black color.
</constant>
<constant name="blanchedalmond" value="Color( 1, 0.92, 0.8, 1 )">
Blanche almond color.
Blanched almond color.
</constant>
<constant name="blue" value="Color( 0, 0, 1, 1 )">
Blue color.
Expand All @@ -348,7 +348,7 @@
Brown color.
</constant>
<constant name="burlywood" value="Color( 0.87, 0.72, 0.53, 1 )">
Burly wood color.
Burlywood color.
Vivraan marked this conversation as resolved.
Show resolved Hide resolved
</constant>
<constant name="cadetblue" value="Color( 0.37, 0.62, 0.63, 1 )">
Cadet blue color.
Expand All @@ -362,8 +362,8 @@
<constant name="coral" value="Color( 1, 0.5, 0.31, 1 )">
Coral color.
</constant>
<constant name="cornflower" value="Color( 0.39, 0.58, 0.93, 1 )">
Cornflower color.
<constant name="cornflowerblue" value="Color( 0.39, 0.58, 0.93, 1 )">
Cornflower Blue color.
Vivraan marked this conversation as resolved.
Show resolved Hide resolved
</constant>
<constant name="cornsilk" value="Color( 1, 0.97, 0.86, 1 )">
Corn silk color.
Expand Down
15 changes: 10 additions & 5 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public static class Colors
{"chartreuse", new Color(0.50f, 1.00f, 0.00f)},
{"chocolate", new Color(0.82f, 0.41f, 0.12f)},
{"coral", new Color(1.00f, 0.50f, 0.31f)},
{"cornflower", new Color(0.39f, 0.58f, 0.93f)},
{"cornflower", new Color(0.39f, 0.58f, 0.93f)}, // for compatibility
{"cornflowerblue", new Color(0.39f, 0.58f, 0.93f)},
{"cornsilk", new Color(1.00f, 0.97f, 0.86f)},
{"crimson", new Color(0.86f, 0.08f, 0.24f)},
{"cyan", new Color(0.00f, 1.00f, 1.00f)},
Expand Down Expand Up @@ -171,12 +172,14 @@ public static class Colors
public static Color Blue { get { return namedColors["blue"]; } }
public static Color BlueViolet { get { return namedColors["blueviolet"]; } }
public static Color Brown { get { return namedColors["brown"]; } }
public static Color BurlyWood { get { return namedColors["burlywood"]; } }
public static Color BurlyWood { get { return namedColors["burlywood"]; } } // for compatibility
public static Color Burlywood { get { return namedColors["burlywood"]; } }
Vivraan marked this conversation as resolved.
Show resolved Hide resolved
public static Color CadetBlue { get { return namedColors["cadetblue"]; } }
public static Color Chartreuse { get { return namedColors["chartreuse"]; } }
public static Color Chocolate { get { return namedColors["chocolate"]; } }
public static Color Coral { get { return namedColors["coral"]; } }
public static Color Cornflower { get { return namedColors["cornflower"]; } }
public static Color Cornflower { get { return namedColors["cornflower"]; } } // for compatibility
public static Color CornflowerBlue { get { return namedColors["cornflowerblue"]; } }
Vivraan marked this conversation as resolved.
Show resolved Hide resolved
public static Color Cornsilk { get { return namedColors["cornsilk"]; } }
public static Color Crimson { get { return namedColors["crimson"]; } }
public static Color Cyan { get { return namedColors["cyan"]; } }
Expand Down Expand Up @@ -236,7 +239,8 @@ public static class Colors
public static Color LightSteelBlue { get { return namedColors["lightsteelblue"]; } }
public static Color LightYellow { get { return namedColors["lightyellow"]; } }
public static Color Lime { get { return namedColors["lime"]; } }
public static Color Limegreen { get { return namedColors["limegreen"]; } }
public static Color Limegreen { get { return namedColors["limegreen"]; } } // for compatibility
public static Color LimeGreen { get { return namedColors["limegreen"]; } }
public static Color Linen { get { return namedColors["linen"]; } }
public static Color Magenta { get { return namedColors["magenta"]; } }
public static Color Maroon { get { return namedColors["maroon"]; } }
Expand Down Expand Up @@ -280,7 +284,8 @@ public static class Colors
public static Color Salmon { get { return namedColors["salmon"]; } }
public static Color SandyBrown { get { return namedColors["sandybrown"]; } }
public static Color SeaGreen { get { return namedColors["seagreen"]; } }
public static Color SeaShell { get { return namedColors["seashell"]; } }
public static Color SeaShell { get { return namedColors["seashell"]; } } // for compatibility
public static Color Seashell { get { return namedColors["seashell"]; } }
Vivraan marked this conversation as resolved.
Show resolved Hide resolved
public static Color Sienna { get { return namedColors["sienna"]; } }
public static Color Silver { get { return namedColors["silver"]; } }
public static Color SkyBlue { get { return namedColors["skyblue"]; } }
Expand Down