|ReleasedLast Release||Dec 2014|
Maintained by Paul Williamson.
Returns either black or white based on the contrast against the current colour.
There are currently two options for determining which colour to use: the 50% method, or the YIQ method.
The self colour is converted to hex then checked if it is >= 0x808080. If the colour is >= 0x808080 then black colour is returned, otherwise white colour is returned.
The YIQ method is arguably better as it applies weighting to the colours, which could result in better contrast matches.
Using CocoaPods, add the following to your Podfile
Alternatively, just drag the contents of the
Classes folder into your project.
Then import the header and call the method:
UIColor *redColor = [UIColor redColor]; UIColor *textColor = [redColor sqf_contrastingColorWithMethod:SQFContrastingColorYIQMethod];