-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Allows getting the hue, saturation and brightness components of UIColor. #51
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,30 @@ public extension UIColor { | |
return a | ||
} | ||
} | ||
|
||
var hueComponent : CGFloat { | ||
get { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is computed property, I don't think you need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same as before, I know you don't need the get, but left it following the coding convention on the same extension you used for redComponent. |
||
var hue : CGFloat = 0 | ||
getHue(&hue, saturation: nil, brightness: nil, alpha: nil) | ||
return hue | ||
} | ||
} | ||
|
||
var saturationComponent : CGFloat { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you use 2 spaces indentation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think my Xcode defaults to 4 spaces indentation. I'll check. |
||
get { | ||
var saturation : CGFloat = 0 | ||
getHue(nil, saturation: &saturation, brightness: nil, alpha: nil) | ||
return saturation | ||
} | ||
} | ||
|
||
var brightnessComponent : CGFloat { | ||
get { | ||
var brightness : CGFloat = 0 | ||
getHue(nil, saturation: nil, brightness: &brightness, alpha: nil) | ||
return brightness | ||
} | ||
} | ||
} | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the space before the
:
to match our convention?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's funny because I never leave that space but left it following the coding convention on the same extension you used for redComponent.