We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c40333c commit c5cad01Copy full SHA for c5cad01
arcade/types.py
@@ -159,6 +159,26 @@ def b(self) -> int:
159
def a(self) -> int:
160
return self[3]
161
162
+ @property
163
+ def rgb(self) -> Tuple[int, int, int]:
164
+ """Return only a color's RGB components.
165
+
166
+ This is syntactic sugar for slice indexing as below:
167
168
+ .. code-block:: python
169
170
+ >>> from arcade.color import WHITE
171
+ >>> WHITE[:3]
172
+ (255, 255, 255)
173
+ # Equivalent but slower than the above
174
+ >>> (WHITE.r, WHITE.g, WHITE.b)
175
176
177
+ To reorder the channels as you retrieve them, see
178
+ :meth:`.swizzle`.
179
+ """
180
+ return self[:3]
181
182
@classmethod
183
def from_iterable(cls, iterable: Iterable[int]) -> Self:
184
"""
0 commit comments