Add Colour.random factory method
This commit is contained in:
parent
25f23ec113
commit
896a5bef1d
@ -25,6 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import colorsys
|
import colorsys
|
||||||
|
import random
|
||||||
|
|
||||||
class Colour:
|
class Colour:
|
||||||
"""Represents a Discord role colour. This class is similar
|
"""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``."""
|
"""A factory method that returns a :class:`Colour` with a value of ``0``."""
|
||||||
return cls(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
|
@classmethod
|
||||||
def teal(cls):
|
def teal(cls):
|
||||||
"""A factory method that returns a :class:`Colour` with a value of ``0x1abc9c``."""
|
"""A factory method that returns a :class:`Colour` with a value of ``0x1abc9c``."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user