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 9a8350e commit c0c5977Copy full SHA for c0c5977
arcade/types.py
@@ -154,6 +154,26 @@ def b(self) -> int:
154
def a(self) -> int:
155
return self[3]
156
157
+ @property
158
+ def rgb(self) -> Tuple[int, int, int]:
159
+ """Return only a color's RGB components.
160
+
161
+ This is syntactic sugar for slice indexing as below:
162
163
+ .. code-block:: python
164
165
+ >>> from arcade.color import WHITE
166
+ >>> WHITE[:3]
167
+ (255, 255, 255)
168
+ # Equivalent but slower than the above
169
+ >>> (WHITE.r, WHITE.g, WHITE.b)
170
171
172
+ To reorder the channels as you retrieve them, see
173
+ :meth:`.swizzle`.
174
+ """
175
+ return self[:3]
176
177
@classmethod
178
def from_iterable(cls, iterable: Iterable[int]) -> Self:
179
"""
0 commit comments