Browse Source

Add Colour.from_rgb.

pull/572/head
Rapptz 8 years ago
parent
commit
6f53491f9a
  1. 5
      discord/colour.py

5
discord/colour.py

@ -97,6 +97,11 @@ class Colour:
"""Returns an (r, g, b) tuple representing the colour."""
return (self.r, self.g, self.b)
@classmethod
def from_rgb(cls, r, g, b):
"""Constructs a :class:`Colour` from an RGB tuple."""
return cls((r << 16) + (g << 8) + b)
@classmethod
def default(cls):
"""A factory method that returns a :class:`Colour` with a value of 0."""

Loading…
Cancel
Save