Skip to content

Swizzle support for colors #1998

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

Merged
merged 8 commits into from
Feb 27, 2024
Merged

Conversation

DigiDuncan
Copy link
Collaborator

We talked about this in the Discord once. And why not, right? It's a cheap function to write.

Could probably have docs or something!

Takes a string of r, g, b, and a's and returns a tuple of those properties in order.

It's an OpenGL thing.

Copy link
Member

@pushfoo pushfoo left a comment

Choose a reason for hiding this comment

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

This is almost ready. I think the current implementation is faster and easier than __getattribute__ hacks, even if color_instance.brga would be cleaner code.

Changes I'd like:

  1. Use ValueError insteaad of Exception
  2. Consider mentioning the offending value in the exception
  3. Add tests

Copy link
Member

@pushfoo pushfoo left a comment

Choose a reason for hiding this comment

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

This looks good now.

@einarf einarf merged commit fb18ea9 into pythonarcade:development Feb 27, 2024
@DigiDuncan DigiDuncan deleted the swizzle branch July 3, 2024 23:35
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.

3 participants