Skip to content

Make Color constants usable without affecting alpha #1838

@bunny-therapist

Description

@bunny-therapist

Enhancement request:

What should be added/changed?

Add an "rgb" method to arcade.types.Color which return a 3-tuple (type "RGB") based on the color, i.e., it leaves out the alpha.

What would it help with?

In arcade 2, Sprite.alpha was separate from Sprite.color, so one could use the constants in arcade.color to set the color without changing the alpha of the sprite. For example, self.color = arcade.color.WHITE would not affect the alpha of the Sprite. Now it does, which means makes the color constants much less usable. With an "rgb" property, one could do self.color = arcade.color.WHITE.rgb which would not affect alpha since the color setter checks the length of the input.

One can currently do the same, of course, by either inputting the color numbers directly as a tuple (but then what are the color constants even good for?) or by grabbing the constant and accessing its r, g, and b properties (but that is very messy).

Arcade 3.0.0.dev23
------------------
vendor: Intel
renderer: Intel(R) UHD Graphics
version: (3, 3)
python: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
platform: win32
pyglet version: 2.0.7
PIL version: 9.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions