diff options
| author | Caio Alexandre <[email protected]> | 2020-11-19 12:23:59 -0300 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-11-21 22:16:41 -0500 |
| commit | 896a5bef1d9726bfad771a1131a98f4130405d47 (patch) | |
| tree | 81022879f7ec6134001f6b48a1208522b53bdeba | |
| parent | Properly document that categories throw 404's on create_invite. (diff) | |
| download | discord.py-896a5bef1d9726bfad771a1131a98f4130405d47.tar.xz discord.py-896a5bef1d9726bfad771a1131a98f4130405d47.zip | |
Add Colour.random factory method
| -rw-r--r-- | discord/colour.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/colour.py b/discord/colour.py index 804173a4..c2acfb4e 100644 --- a/discord/colour.py +++ b/discord/colour.py @@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE. """ import colorsys +import random class Colour: """Represents a Discord role colour. This class is similar @@ -118,6 +119,11 @@ class Colour: return cls(0) @classmethod + def random(cls): + """A factory method that returns a :class:`Colour` with a random value.""" + return cls.from_hsv(random.random(), 1, 1) + + @classmethod def teal(cls): """A factory method that returns a :class:`Colour` with a value of ``0x1abc9c``.""" return cls(0x1abc9c) |