Skip to content

feat: color randomization / color resolution #8

Description

@sudojunior

A bit of a two in one, color might also be of some use to expand this later on.

TypeScript, in it's standard use, would only allow color to be of type number, but some things can be worked around if it needs to be done.

if (Array.isArray(embed.color)) embed.color = randomItem(embed.color);
else if (embed.color === 'RANDOM') embed.color = Math.ceil(Math.random() * 0xFFFFFF);
else if (embed.color.startsWith('#')) embed.color = parseInt(embed.color.replace(/^#?/, ''), 16);

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions