Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(colord): add toBase10 #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kyranet
Copy link

@kyranet kyranet commented Aug 8, 2023

Fixes #104

I chose not to add src/colorModels/base10.ts (and therefore support numbers as input) because it would be impossible to properly determine whether a number is RGB or RGBA, so the solution I reached was to just add a method.

This addition would also prove very helpful for APIs that natively use (and support) base10 numbers, such as Discord.

Since `.base10()` is similar to `toHex()`, we can use the same string to
retrieve the number without modifying `lime`, which can lead to higher
complexity in the tests as `colord` does not support numbers as input
and would require an `if (typeof lime[format] === 'number') continue;`
or an `if (format === 'base10') continue;` check otherwise.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output in 0xRRGGBB format?
1 participant