I'm quite new to objective c but have been programming for a while. I started creating a function that would convert from RGB to HSL and back again but I get a feeling it is way too long and headed in the wrong direction. Does anyone know of a simple way to perform this conversion?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- back button text does not change
相关文章
- 现在使用swift开发ios应用好还是swift?
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
You can use
NSColor
, I think.On second thought, I don't know if
NSColor
is available in the iPhone frameworks or not - isn't there aUIColor
? Anyway I'll leave this answer in case someone searching for an OS X solution ends up here.You can add the UIColor-HSVAdditions.h/.m category to your app to add a set of operations to UIColor for working with hue, saturation and value. See http://bravobug.com/news/?p=448 and this ArsTechnica article also.
NSColor is missing in iPhone SDK. You can use this utility to convert from RGB to HSL space and back:
https://github.com/alessani/ColorConverter
Here's what I'm using:
And here's how to call it: