mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
add random color (#1175)
* add random color * Update ClientDataResolver.js * Update ClientDataResolver.js
This commit is contained in:
parent
ab5e57d94b
commit
7c8f534a38
1 changed files with 2 additions and 0 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Reference in a new issue