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

Relocate Color8 and ColorN methods from @GDScript class to Color class #30499

Closed
aabmets opened this issue Jul 10, 2019 · 6 comments · Fixed by #100825
Closed

Relocate Color8 and ColorN methods from @GDScript class to Color class #30499

aabmets opened this issue Jul 10, 2019 · 6 comments · Fixed by #100825

Comments

@aabmets
Copy link

aabmets commented Jul 10, 2019

Should functions of similar functionality not belong to the same class?

@akien-mga
Copy link
Member

They cannot be in the Color class while providing Color8() and ColorN() sugar constructors. I'm not against merging their functionality into Color, but the API would have to be different, and I don't think we can have static methods on Color either, so it could be awkward:

var color = Color()
color.set_8bit(255, 255, 255, 0)
color.set_named("rubicon")

CC @bojidar-bg who implemented those IIRC.

@bojidar-bg
Copy link
Contributor

bojidar-bg commented Jul 11, 2019

ColorN(NAME) already exists as Color.NAME, while Color8 is there since the earliest days of Godot FOSS.

@aabmets
Copy link
Author

aabmets commented Jul 11, 2019 via email

@Calinou
Copy link
Member

Calinou commented Nov 28, 2021

Now that static methods can be bound to engine types in master, should this still be considered for 4.0? cc @vnen

@Calinou Calinou added this to the 4.0 milestone Nov 28, 2021
@alazifk
Copy link

alazifk commented Sep 19, 2022

IMHO now in the future Color should get static Color.from_rgba8() anyway, analogous to Color.from_hsv(), Color.from_rgbe9995(). Then I see no reason to keep Color8(), also I am not a fan of having a function that looks like a constructor, speaking as someone who has gone a long time thinking there is a class Color8 that derives from Color.

@akien-mga
Copy link
Member

The named colors were moved to a static method, but not Color8. Adding a from_rgba8 could still be done.

@akien-mga akien-mga removed this from the 4.0 milestone Feb 26, 2023
@akien-mga akien-mga modified the milestones: 4.5, 4.4 Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants