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

Added support for colours with alpha values. #5

Merged
merged 1 commit into from Feb 9, 2016

Conversation

mpretty-cyro
Copy link
Contributor

Currently if you set a colour with a hex value it will display the wrong colour, this adds support for colours with alpha values.

@mpretty-cyro
Copy link
Contributor Author

@maxs15 Since the change is so minor I'm hoping this can be merged fairly quickly.

@maxs15
Copy link
Owner

maxs15 commented Feb 9, 2016

hey @mpretty-homepass,
Why didn't you use the style opacity property ?

@mpretty-cyro
Copy link
Contributor Author

@maxs15 When it comes to animations or general opacity then I probably would use the style's opacity property, but the case I'm using is applying a global theme which may actually include the opacity in the hex value (having to pass through multiple values to define a global 'primary colour' would be inconvenient).

You could also just ignore the opacity in the hex (currently if you pass it through it will render as an incorrect colour which I initially thought was a bug before I looked in to what it was doing) - this way when a user passes through a hex value which includes opacity, it should be fairly obvious that the opacity part is being ignored.

@maxs15
Copy link
Owner

maxs15 commented Feb 9, 2016

Ok fair reason, I was just curious..
I'll merge your PR, thanks for the contribution

@maxs15 maxs15 closed this Feb 9, 2016
@maxs15 maxs15 reopened this Feb 9, 2016
maxs15 added a commit that referenced this pull request Feb 9, 2016
Added support for colours with alpha values.
@maxs15 maxs15 merged commit f576828 into maxs15:master Feb 9, 2016
@mpretty-cyro
Copy link
Contributor Author

@maxs15 No problem, you have every right to ask why. Here is an example of an issue I ran in to the first time I used SpinKit - I set a primary theme colour of '#4D9E02FF' (it enforces no opacity on the colour) and the following occurred:

incorrect

Whereas the colour should be:

correct colour

Just want to ensure users don't run in to the same issue in the future. Another expansion to this would probably be to add support for 3 char hex values (ie. '#F11' becomes '#F11F11'), since it is supported by React Native.

@maxs15
Copy link
Owner

maxs15 commented Feb 9, 2016

I see the issue, thanks for this nice and colorful explanation, if you need any further enhancements I'll always accept any PR :)
Your fix is now available in the new version 0.0.7 !

@mpretty-cyro
Copy link
Contributor Author

Awesome, thanks for that :)

maxs15 added a commit that referenced this pull request Oct 4, 2020
Added support for colours with alpha values.
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.

None yet

2 participants