Skip to content

Commit

Permalink
add random color (#1175)
Browse files Browse the repository at this point in the history
* add random color

* Update ClientDataResolver.js

* Update ClientDataResolver.js
  • Loading branch information
devsnek authored and Gawdl3y committed Feb 7, 2017
1 parent ab5e57d commit 7c8f534
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/ClientDataResolver.js
Expand Up @@ -343,6 +343,7 @@ class ClientDataResolver {
* 'DARK_GREY',
* 'LIGHT_GREY',
* 'DARK_NAVY',
* 'RANDOM',
* ]
* ```
* or something like
Expand All @@ -360,6 +361,7 @@ class ClientDataResolver {
*/
static resolveColor(color) {
if (typeof color === 'string') {
if (color === 'RANDOM') return Math.floor(Math.random() * (0xFFFFFF + 1));
color = Constants.Colors[color] || parseInt(color.replace('#', ''), 16);
} else if (color instanceof Array) {
color = (color[0] << 16) + (color[1] << 8) + color[2];
Expand Down

1 comment on commit 7c8f534

@gavwin
Copy link
Contributor

@gavwin gavwin commented on 7c8f534 May 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Please sign in to comment.