aboutsummaryrefslogtreecommitdiff
path: root/discord/role.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/role.py')
-rw-r--r--discord/role.py163
1 files changed, 1 insertions, 162 deletions
diff --git a/discord/role.py b/discord/role.py
index 490df159..00b38aca 100644
--- a/discord/role.py
+++ b/discord/role.py
@@ -25,168 +25,7 @@ DEALINGS IN THE SOFTWARE.
"""
from .permissions import Permissions
-
-class Colour(object):
- """Represents a Discord role colour. This class is similar
- to an (red, green, blue) tuple.
-
- There is an alias for this called Color.
-
- Supported operations:
-
- +-----------+--------------------------------------+
- | Operation | Description |
- +===========+======================================+
- | x == y | Checks if two colours are equal. |
- +-----------+--------------------------------------+
- | x != y | Checks if two colours are not equal. |
- +-----------+--------------------------------------+
-
- Instance attributes:
-
- .. attribute:: value
-
- The raw integer colour value.
- """
-
- def __init__(self, value):
- self.value = value
-
- def _get_byte(self, byte):
- return (self.value >> (8 * byte)) & 0xff
-
- def __eq__(self, other):
- return self.value == getattr(other, 'value', None)
-
- def __ne__(self, other):
- return isinstance(other, Colour) and self.value != other.value
-
- @property
- def r(self):
- """Returns the red component of the colour."""
- return self._get_byte(2)
-
- @property
- def g(self):
- """Returns the green component of the colour."""
- return self._get_byte(1)
-
- @property
- def b(self):
- """Returns the blue component of the colour."""
- return self._get_byte(0)
-
- def to_tuple(self):
- """Returns an (r, g, b) tuple representing the colour."""
- return (self.r, self.g, self.b)
-
- @classmethod
- def default(cls):
- """A factory method that returns a :class:`Colour` with a value of 0."""
- return cls(0)
-
- @classmethod
- def cyan(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x1abc9c."""
- return cls(0x1abc9c)
-
- @classmethod
- def green(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x2ecc71."""
- return cls(0x2ecc71)
-
- @classmethod
- def blue(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x3498db."""
- return cls(0x3498db)
-
- @classmethod
- def purple(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x9b59b6."""
- return cls(0x9b59b6)
-
- @classmethod
- def yellow(cls):
- """A factory method that returns a :class:`Colour` with a value of 0xf1c40f."""
- return cls(0xf1c40f)
-
- @classmethod
- def orange(cls):
- """A factory method that returns a :class:`Colour` with a value of 0xe67e22."""
- return cls(0xe67e22)
-
- @classmethod
- def red(cls):
- """A factory method that returns a :class:`Colour` with a value of 0xe74c3c."""
- return cls(0xe74c3c)
-
- @classmethod
- def grey(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x95a5a6."""
- return cls(0x95a5a6)
-
- @classmethod
- def dark_grey(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x7f8c8d."""
- return cls(0x7f8c8d)
-
- @classmethod
- def navy_blue(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x34495e."""
- return cls(0x34495e)
-
- @classmethod
- def dark_cyan(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x11806a."""
- return cls(0x11806a)
-
- @classmethod
- def dark_green(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x1f8b4c."""
- return cls(0x1f8b4c)
-
- @classmethod
- def dark_blue(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x206694."""
- return cls(0x206694)
-
- @classmethod
- def dark_purple(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x71368a."""
- return cls(0x71368a)
-
- @classmethod
- def strong_orange(cls):
- """A factory method that returns a :class:`Colour` with a value of 0xc27c0e."""
- return cls(0xc27c0e)
-
- @classmethod
- def dark_orange(cls):
- """A factory method that returns a :class:`Colour` with a value of 0xa84300."""
- return cls(0xa84300)
-
- @classmethod
- def dark_red(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x992d22."""
- return cls(0x992d22)
-
- @classmethod
- def dark_grey_blue(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x979c9f."""
- return cls(0x979c9f)
-
- @classmethod
- def light_grey(cls):
- """A factory method that returns a :class:`Colour` with a value of 0xbcc0c0."""
- return cls(0xbcc0c0)
-
- @classmethod
- def dark_navy_blue(cls):
- """A factory method that returns a :class:`Colour` with a value of 0x2c3e50."""
- return cls(0x2c3e50)
-
-
-Color = Colour
+from .colour import Colour
class Role(object):
"""Represents a Discord role in a :class:`Server`.