Browse Source

Add Colour.random factory method

pull/6076/head
Caio Alexandre 4 years ago
committed by Rapptz
parent
commit
896a5bef1d
  1. 6
      discord/colour.py

6
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
@ -117,6 +118,11 @@ class Colour:
"""A factory method that returns a :class:`Colour` with a value of ``0``."""
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``."""

Loading…
Cancel
Save