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

Add .rgb properties + tests for Color, Sprite, and BasicSprite #2060

Merged
merged 14 commits into from
Apr 16, 2024

Conversation

pushfoo
Copy link
Member

@pushfoo pushfoo commented Apr 10, 2024

Changes

To the old PR:

Supersedes #1970 by:

  • Resolving merge conflicts
  • Squashing down the old stalled PR into one commit (FriendlyGecko still gets credit!)
  • Reverting non-critical changes

To Arcade

Closes #1838 (Marked as 3.0 Mandatory) by:

  • Add .rgb syntactic sugar property to Color
  • Add .rgb property to BasicSprite and subclasses:
    • It largely works like BasicSprite.color
    • The difference is it always ignores any present alpha value
  • Add preliminary tests

The groundwork for this was handled by #2029.

Remaining questions

  • Add exhaustive tests for channel setting? (these will be iterative, not unrolled)
  • Add similar tests for .color?

@pushfoo
Copy link
Member Author

pushfoo commented Apr 10, 2024

The GitHub basd tests / Code inspections step is failing on GUI / Text pyright issues as it has been recently.

FriendlyGecko and others added 14 commits April 15, 2024 20:33
* Updated the color setter so that it does not change the current alpha

* Updated it to check for use arcade.Color

* Added an isintance check to the len3 check and moved those before the len4 check. So now if the user does a tuple of 3 (ie (255,255,255)) or uses the arcade.Color type (i.e. arcade.Color.BLACK) it will just reuse the old alpha.

* Demo 1

* Added deeper RGB class

* cleaned up RGB
@pushfoo
Copy link
Member Author

pushfoo commented Apr 16, 2024

TL;DR: This is ready to review.

The recent force-push is a rebase onto development to get #2062's pyright fixes.

@einarf einarf merged commit d4f61e1 into pythonarcade:development Apr 16, 2024
8 checks passed
@FriendlyGecko
Copy link
Contributor

In regards to my previous merge request, should I close it or is there something still relevant about it?

@pushfoo
Copy link
Member Author

pushfoo commented Apr 29, 2024

@FriendlyGecko TL;DR: Don't delete the branch yet.

We split the types module recently in #2065. That makes it easier to do future color improvements, but they'll probably have to wait till 3.1+ at the earliest.

Before we do more with color, we first have a bunch of other things to do:

  • 3.0 fixes for cameras, including the rectangle cleanup DigiDuncan has started
  • Exploring a Lerpable Protocol type
  • Cleaning up the math module

After 3.0, we might be able to start improving color types further.

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.

Make Color constants usable without affecting alpha
3 participants