Skip to content

Commit

Permalink
Add defaults classmethod to Colour
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Feb 12, 2025
1 parent 25cd824 commit 7954498
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions twitchio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,35 @@ def __format__(self, format_spec: str) -> str:
def __int__(self) -> int:
return self._code

@classmethod
def defaults(cls) -> tuple[Self, ...]:
"""Classmethod which returns a :class:`tuple` of :class:`~twitchio.Colour` representing every default chat colour
on Twitch.
Returns
-------
tuple[:class:`~twitchio.Colour`]
A tuple of :class:`~twitchio.Colour` representing every default colour.
"""
all_ = (
cls.blue(),
cls.blue_violet(),
cls.cadet_blue(),
cls.chocolate(),
cls.coral(),
cls.dodger_blue(),
cls.firebrick(),
cls.green(),
cls.golden_rod(),
cls.hot_pink(),
cls.orange_red(),
cls.sea_green(),
cls.spring_green(),
cls.yellow_green(),
)

return all_

@classmethod
def from_hex(cls, hex_: str, /) -> Self:
"""Class method to create a :class:`~twitchio.Colour` object from a hex string.
Expand Down

0 comments on commit 7954498

Please sign in to comment.