mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
add random color (#1175)
* add random color * Update ClientDataResolver.js * Update ClientDataResolver.js
This commit is contained in:
committed by
Schuyler Cebulskie
parent
ab5e57d94b
commit
7c8f534a38
@@ -343,6 +343,7 @@ class ClientDataResolver {
|
||||
* 'DARK_GREY',
|
||||
* 'LIGHT_GREY',
|
||||
* 'DARK_NAVY',
|
||||
* 'RANDOM',
|
||||
* ]
|
||||
* ```
|
||||
* or something like
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user