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

Cannot seem to set onColor and offColor for FUISwitch to white #11

Closed
lnpbk opened this issue May 17, 2013 · 3 comments
Closed

Cannot seem to set onColor and offColor for FUISwitch to white #11

lnpbk opened this issue May 17, 2013 · 3 comments

Comments

@lnpbk
Copy link
Contributor

lnpbk commented May 17, 2013

If I apply a whiteColor to on and off state, the label text appears black for both states:

screen shot 2013-05-17 at 21 50 31

_annual.onColor  = [UIColor whiteColor];
_annual.offColor = [UIColor whiteColor];
@lnpbk
Copy link
Contributor Author

lnpbk commented May 17, 2013

Perhaps a check to see if the colours equate before blending in FUISwitch.m ~ Line 160:

UIColor *contentColor;

if (self.onColor == self.offColor) {
    contentColor = self.onColor;
} else {
    contentColor = [UIColor blendedColorWithForegroundColor:self.onColor
                                            backgroundColor:self.offColor
                                               percentBlend:self.percentOn];
}

@JohnWickham
Copy link

If you look in the UIColor+FlatUI class, it declares several custom UIColors by converting hexadecimal strings into color... I found you can either use the colors they have provided, or create a new UIColor just as they have done with your own custom hexadecimal code...

@jflinter
Copy link
Contributor

Interesting. I was blending colors incorrectly if they were in the wrong color space (i.e. whiteColor, greyColor, blackColor, etc). This is fixed in 1e017e0. Thanks!

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

3 participants