Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: color randomization / color resolution #8

Open
sudojunior opened this issue Dec 4, 2022 · 0 comments
Open

feat: color randomization / color resolution #8

sudojunior opened this issue Dec 4, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@sudojunior
Copy link
Member

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);
@sudojunior sudojunior added the enhancement New feature or request label Dec 4, 2022
@sudojunior sudojunior self-assigned this Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant