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

colors: add alpha() function to modify constant colors easily #660

Closed
wants to merge 1 commit into from

Conversation

naufraghi
Copy link

Like RED.alpha(0.5)

@naufraghi
Copy link
Author

naufraghi commented Oct 18, 2023

Just a suggestion, was handy in my exploration. Feel free to close the PR. Kudos for macroquad!

@not-fl3
Copy link
Owner

not-fl3 commented Oct 18, 2023

I like how RED.alpha(0.5) looks, and it is indeed shorter and cleaner than Color {a: 0.5, ..RED}
But I do not really like that other color components doesn't work like this and neither do vectors/any other structs we got.

To be honest I do not have a strong enough opinion on consistency vs convinience so I can't make a decision on merging it or not.

@naufraghi
Copy link
Author

My ratio was:

  1. a is a bit special as a color component, the color is the same, but with a special transparency feature. Changing rgb makes a new color,
  2. Constant colors are a limited number, and usually used arbitrarily just to put something on the screen. In this setting it's handy for exploration to see below something, hence the alpha modifier.

But, I completely overlooked the Color {a: 0.5, ..RED} option, it works well enough without any unbalance in the API!

@naufraghi naufraghi closed this Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants