aboutsummaryrefslogtreecommitdiff
path: root/src/utils/colour.rs
Commit message (Collapse)AuthorAgeFilesLines
* add method Colour::hexMishio5952018-09-161-4/+2
|
* Add Colour::hexMishio5952018-08-111-0/+16
| | | | (cherry picked from commit 6c94e05f6a8de131d0ffc913fd6ccbad602b339e)
* Move unit tests into sourceZeyla Hellyer2018-08-011-0/+52
| | | | | | | | | Move the unit tests into the relevant source files. There's no need for them to be seprate, especially when the `tests` directory is meant to be for integration tests. The deserialization tests that include JSON files are still in the `tests` dir, along with the public prelude re-export tests.
* Fix some clippy lintsZeyla Hellyer2018-07-151-5/+7
| | | | | Some lints were not resolved due to causing API changes. Most lints in the framework were left unfixed.
* Add associated consts in Colour, deprecate methodsZeyla Hellyer2018-07-071-36/+42
| | | | | | Add associated constants to the `utils::Colour` struct for all of the colour presets. Additionally, deprecate the method equivalents, preferring to use associated constants instead.
* Fix broken docs links caused by model mod changesZeyla Hellyer2018-01-311-1/+1
| | | | | Fix broken links caused by the `model` module changes in v0.5.0, which split up the module into sub-modules for better organization.
* Break up the model moduleZeyla Hellyer2017-12-161-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `model` module has historically been one giant module re-exporting all of the model types, which is somewhere around 100 types. This can be a lot to look at for a new user and somewhat overwhelming, especially with a large number of fine-grained imports from the module. The module is now neatly split up into submodules, mostly like it has been internally since the early versions of the library. The submodules are: - application - channel - error - event - gateway - guild - id - invite - misc - permissions - prelude - user - voice - webhook Each submodule contains types that are "owned" by the module. For example, the `guild` submodule contains, but not limited to, Emoji, AuditLogsEntry, Role, and Member. `channel` contains, but not limited to, Attachment, Embed, Message, and Reaction. Upgrade path: Instead of glob importing the models via `use serenity::model::*;`, instead glob import via the prelude: ```rust use serenity::model::prelude::*; ``` Instead of importing from the root model module: ```rust use serenity::model::{Guild, Message, OnlineStatus, Role, User}; ``` instead import from the submodules like so: ```rust use serenity::model::channel::Message; use serenity::model::guild::{Guild, Role}; use serenity::model::user::{OnlineStatus, User}; ```
* Fix clippy lintsZeyla Hellyer2017-10-111-3/+3
|
* `to_owned` -> `to_string`acdenisSK2017-10-011-1/+1
|
* Clippy lintsZeyla Hellyer2017-08-181-0/+3
|
* Apply rustfmtZeyla Hellyer2017-08-181-1/+1
|
* Make colour implement `From<(u8, u8, u8)>`acdenisSK2017-08-011-0/+5
|
* rustfmtacdenisSK2017-07-271-27/+9
|
* Remove the deprecated functionsacdenisSK2017-07-111-36/+0
| | | | It's already been enough time for people to migrate
* Add more examples and improve some othersZeyla Hellyer2017-05-231-4/+15
| | | | | Add examples to some functions, and update some of the old examples to use the `?` operator instead of unwrapping.
* Add faded_purple to colour listMei2017-05-131-1/+3
| | | Add `faded_purple` as a Colour, and rename `meibi_pink` to `meibe_pink`.
* Deprecate methods prefixed with `get_`Zeyla Hellyer2017-04-191-26/+62
| | | | | | A lot of structs - such as `Guild` or `ChannelId` - have methods with prefixes of `get_`, which are generally discouraged. To fix this, deprecate them and remove them in v0.3.0.
* Switch to using serde for deserializationZeyla Hellyer2017-04-111-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current build system is rudimentary, incomplete, and rigid, offering little in the way of customizing decoding options. To solve this, switch to using serde-derive with custom Deserialization implementations. This allows very simple deserialization when special logic does not need to be applied, yet allows us to implement our own deserialization logic when required. The problem with the build system was that it built enums and structs from YAML files. This is not so good, because it requires creating a custom build system (which was rudimentary), creating "special struct configs" when logic needed to be ever so slightly extended (rigid), and if special logic needed to be applied, a custom deserialization method would have been needed to be made anyway (incomplete). To solve this, switch to serde-derive and implementing Deserialize ourselves where required. This reduces YAML definitions that might look like: ```yaml --- name: Group description: > A group channel, potentially including other users, separate from a [`Guild`]. [`Guild`]: struct.Guild.html fields: - name: channel_id description: The Id of the group channel. from: id type: ChannelId - name: icon description: The optional icon of the group channel. optional: true type: string - name: last_message_id description: The Id of the last message sent. optional: true type: MessageId - name: last_pin_timestamp description: Timestamp of the latest pinned message. optional: true type: string - name: name description: The name of the group channel. optional: true type: string - name: owner_id description: The Id of the group channel creator. type: UserId - name: recipients description: Group channel's members. custom: decode_users t: UserId, Arc<RwLock<User>> type: hashmap ``` to: ```rs /// A group channel - potentially including other [`User`]s - separate from a /// [`Guild`]. /// /// [`Guild`]: struct.Guild.html /// [`User`]: struct.User.html pub struct Group { /// The Id of the group channel. #[serde(rename="id")] pub channel_id: ChannelId, /// The optional icon of the group channel. pub icon: Option<String>, /// The Id of the last message sent. pub last_message_id: Option<MessageId>, /// Timestamp of the latest pinned message. pub last_pin_timestamp: Option<String>, /// The name of the group channel. pub name: Option<String>, /// The Id of the group owner. pub owner_id: UserId, /// A map of the group's recipients. #[serde(deserialize_with="deserialize_users")] pub recipients: HashMap<UserId, Arc<RwLock<User>>>, } ``` This is much simpler and does not have as much boilerplate. There should not be any backwards incompatible changes other than the old, public - yet undocumented (and hidden from documentation) - decode methods being removed. Due to the nature of this commit, field names may be incorrect, and will need to be corrected as deserialization errors are found.
* Convert Colour to be a tuple structAustin Hellyer2017-01-131-22/+15
| | | | The struct only has one field (`value`) anyway.
* Add Rohrkatze Blue to Colour structBrendan McCarthy2017-01-061-0/+2
|
* Add Meibi Pink to coloursMei2017-01-021-0/+2
|
* Fix typoIllia2016-12-311-3/+3
|
* Make Member::colour() return an optional colourAustin Hellyer2016-12-031-2/+1
|
* Derive Eq/Ord on ColourAustin Hellyer2016-12-031-1/+14
|
* Make the default Colour value the actual defaultAustin Hellyer2016-12-031-2/+2
| | | | | The Colour value defaulted to 0x0; this is incorrect, as Discord's default colour value is actually 0x99AAB5.
* s/rose_water/rosewaterAustin Hellyer2016-12-031-1/+1
|
* Add rose water colourIllia2016-12-031-0/+2
|
* Add 'fooyoo' to Colour structIsaac Dickinson2016-12-011-1/+3
|
* Add fabled_pink to Colour structKen Swenson2016-12-011-0/+2
|
* Simplify colour macroAustin Hellyer2016-12-011-3/+2
|
* Re-order dark_green colour alphabeticallykhazhyk2016-12-011-2/+2
|
* Capitalize the hex value for blitz_blueKisei2016-11-301-1/+1
|
* Add blitz blue colorCrawl2016-11-301-0/+2
|
* Add Blurple to Colour listGetRektByMe2016-11-301-0/+2
| | | | Add a Blurple colour with RGB value 114,137,218.
* Add kerbal colourindiv02016-11-301-0/+2
|
* A bit of docsAustin Hellyer2016-11-181-22/+138
|
* Add Colour::from_rgbAustin Hellyer2016-11-161-0/+34
| | | | | from_rgb creates a `Colour` from an RGB representation. This is meant as the "opposite" usage of `Colour::new`.
* Decode embed/role colours into Colour structAustin Hellyer2016-11-141-0/+11
| | | | | | This is for a little bit of ergonomics, and is of such a minute cost that it is worth it to just directly decode the u32's received for Role/Embed colours into the Colour struct.
* Add some more documentationAustin Hellyer2016-11-061-2/+4
|
* Initial commitAustin Hellyer2016-10-181-0/+126