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(android): Add WebColor utility for parsing color #3947

Merged
merged 9 commits into from
Dec 14, 2020

Conversation

thomasvidas
Copy link
Contributor

Under package main.java.com.getcapacitor.util;

Uses Color.parseColor under the hood but allows the user to specify an ColorFormat. Right now only RGB, RGBA and ARGB are supported. But it would be cool to add something like HSV or HSL in the future.

Fixes #3903 (but will require changes to a bunch of the plugins)

@jcesarmobile
Copy link
Member

On iOS users can use RGB or RGBA indistinctly, so this should behave the same way.
Instead of having the param for the format, it should only accept the HEX color string, check the length and consider it RGB or RGBA based on it.
And I think iOS also accepts with and without #

@imhoffd
Copy link
Contributor

imhoffd commented Dec 14, 2020

Summary of slack conversation: don't extend Color (just a simple parseColorRGBA(String) -> int), ignore Android color names (hopefully we didn't document support for those anywhere... and if we do accept color names, we should use this list, not Android's)

Copy link
Member

@carlpoole carlpoole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@thomasvidas thomasvidas changed the title feat(android): Add ColorExtended utility for parsing color feat(android): Add WebColor utility for parsing color Dec 14, 2020
@thomasvidas
Copy link
Contributor Author

I will merge this when the plugin PR goes up later today

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.

iOS RGBA / Android ARGB color parsing disparity
4 participants