diff options
| author | acdenisSK <[email protected]> | 2017-08-01 17:07:33 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-08-01 17:07:33 +0200 |
| commit | 6f147e182b60817dd16e7868326b8cfa1f89ac88 (patch) | |
| tree | b15840c81e99e8848638a565b08659cb809dd331 /src/utils | |
| parent | Use ranges instead of guards (diff) | |
| download | serenity-6f147e182b60817dd16e7868326b8cfa1f89ac88.tar.xz serenity-6f147e182b60817dd16e7868326b8cfa1f89ac88.zip | |
Make colour implement `From<(u8, u8, u8)>`
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/colour.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils/colour.rs b/src/utils/colour.rs index b52af9a..cea6f45 100644 --- a/src/utils/colour.rs +++ b/src/utils/colour.rs @@ -227,6 +227,11 @@ impl From<u64> for Colour { fn from(value: u64) -> Colour { Colour(value as u32) } } +impl From<(u8, u8, u8)> for Colour { + /// Constructs a Colour from rgb. + fn from((r, g,b): (u8, u8, u8)) -> Self { Colour::from_rgb(r, g, b) } +} + colour! { /// Creates a new `Colour`, setting its RGB value to `(111, 198, 226)`. blitz_blue, 0x6FC6E2; |