Skip to content

feat(colord): add toBase10#109

Open
kyranet wants to merge 2 commits intoomgovich:masterfrom
kyranet:feat/add-base10-output
Open

feat(colord): add toBase10#109
kyranet wants to merge 2 commits intoomgovich:masterfrom
kyranet:feat/add-base10-output

Conversation

@kyranet
Copy link
Copy Markdown

@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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output in 0xRRGGBB format?

1 participant