diff options
| author | Rapptz <[email protected]> | 2017-05-15 03:36:47 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-05-15 03:37:21 -0400 |
| commit | 6f53491f9a6c18ec68ff1aba50b05e7ea5939524 (patch) | |
| tree | 027471c2d7126ae72bdfa5c8deef7d1064710ddb | |
| parent | [commands] Update check examples to work with rewrite. (diff) | |
| download | discord.py-6f53491f9a6c18ec68ff1aba50b05e7ea5939524.tar.xz discord.py-6f53491f9a6c18ec68ff1aba50b05e7ea5939524.zip | |
Add Colour.from_rgb.
| -rw-r--r-- | discord/colour.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/colour.py b/discord/colour.py index 5c9e31f2..454bafbc 100644 --- a/discord/colour.py +++ b/discord/colour.py @@ -98,6 +98,11 @@ class 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.""" return cls(0) |