https://github.com/mxcl/uicolorperceivedluminance
[UIColor perceivedLuminance]
https://github.com/mxcl/uicolorperceivedluminance
Last synced: 9 months ago
JSON representation
[UIColor perceivedLuminance]
- Host: GitHub
- URL: https://github.com/mxcl/uicolorperceivedluminance
- Owner: mxcl
- Created: 2014-02-01T17:54:01.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-02-22T11:50:22.000Z (over 2 years ago)
- Last Synced: 2025-06-20T17:07:47.558Z (about 1 year ago)
- Language: Objective-C
- Homepage:
- Size: 2.93 KB
- Stars: 18
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```ruby
pod 'UIColor+PerceivedLuminance'
```
Coupled with the `UIImage+AverageColor` pod you can use this pod to determine
what `preferredStatusBarStyle` to set for your ViewControllers:
```objc
#import "UIImage+AverageColor.h"
#import "UIColor+PerceivedLuminance.h"
@implementation MyViewController
- (UIStatusBarStyle)preferredStatusBarStyle {
return self.topImageView.image.averageColor.perceivedLuminance > 0.5
? UIStatusBarStyleLightContent
: UIStatusBarStyleDefault;
}
@end
```
If you are having trouble getting `preferredStatusBarStyle` to be respected, I recommmend this StackOverflow question/answer: http://stackoverflow.com/questions/19108513/uistatusbarstyle-preferredstatusbarstyle-does-not-work-on-ios-7/19365160#19365160