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 (alternative) #45144

Merged
merged 1 commit into from
May 7, 2021

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Jan 12, 2021

Named color constants renamed to UPPERCASE. Unlike #41019, this PR
is complete and implements these changes in the simplest way possible.


I believe the underscores issue was solved quite elegantly (without introducing an extra function as in the original PR). I didn't even have to modify the variant_call.cpp file. And it works correctly.

Also, I compared the naming in different places and filled this into a table (color_consts.ods.zip). It remains to resolve the following naming conflicts (we have to decide who we give preference to, MS or X11):

MS docs (.NET) Wiki (X11) color_names.inc Colors.cs Choice
BurlyWood Burlywood BURLY_WOODBURLYWOOD BurlyWoodBurlywood .NETX11
LightGoldenrodYellow Light Goldenrod LIGHT_GOLDENROD LightGoldenrod X11
Navy Navy Blue NAVY_BLUE NavyBlue X11
SeaShell Seashell SEASHELL Seashell X11
Details

The difficulty is that we have taken these names from two sources. There is no color in MS documentation for REBECCA_PURPLE, WEB_GRAY, WEB_GREEN, WEB_MAROON, WEB_PURPLE, there is no color TRANSPARENT in the Wikipedia page. In theory, the wiki page takes precedence, but in C# some color names are spelled differently. The question is what we should be compatible with. In my opinion, internal compatibility is more important than compatibility with the standard C# class.

I think we should adhere to the following naming scheme:
Color.LIGHT_SEA_GREEN — constant in GDScript.
Colors.LightSeaGreen — constant in C#.
Light sea green color. — description of the constant in the docs.

Therefore, if the documentation says "Seashell color.", Then the constant should be named Color.SEASHELL in GDScript and Colors.Seashell in C#. Otherwise, the description should be "Sea shell color." and the constant should be named Color.SEA_SHELL and Colors.SeaShell.

@aaronfranke Could you review this, please?

doc/classes/Color.xml Outdated Show resolved Hide resolved
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this looks good to me, awesome work!

As for the conflicting color names listed in the OP, IMO all are good as they are in this PR, but ("Seashell" and "SEASHELL") vs ("SeaShell" and "SEA_SHELL") should be up to the community. To me neither is obviously better, and these conflict between the X11 and .NET color names. If I had to pick one, "Seashell" seems quite common, and it's not the color of a shell over the sea (but rather shells of animals in the sea) so I guess that's an argument against "Sea Shell".

Named color constants renamed to UPPERCASE. Unlike godotengine#41019, this PR
is complete and implements these changes in the simplest way possible.

Co-authored-by: Shivam Mukherjee <mshivam98@gmail.com>
@dalexeev
Copy link
Member Author

I think we should follow X11 fully (the only exception is the added TRANSPARENT color). So I changed BURLY_WOOD to BURLYWOOD (see the table).

@akien-mga akien-mga merged commit bcbd480 into godotengine:master May 7, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants