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

Accept rgb string as input #11

Closed
ozyman42 opened this issue May 6, 2022 · 1 comment
Closed

Accept rgb string as input #11

ozyman42 opened this issue May 6, 2022 · 1 comment

Comments

@ozyman42
Copy link

ozyman42 commented May 6, 2022

If the input string is rgb, then filter it through a lib like https://www.npmjs.com/package/rgb-hex before computing the font color.
This way clients can assume any valid CSS color string is also a valid input to this lib and clients can avoid having logic in their own code which checks the color string's contents.

@russoedu
Copy link
Owner

Ts verification is already performed in many steps, both for string inputs and numeric inputs. The only thing is that when it fails a default value is returned (#ffffff) instead of an error.

I'll think of a way to see if it would be possible to return an error without breaking the existing API.

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

No branches or pull requests

2 participants