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

Remove opacity and use alpha component #61

Merged
merged 1 commit into from
Apr 20, 2017
Merged

Remove opacity and use alpha component #61

merged 1 commit into from
Apr 20, 2017

Conversation

frederoni
Copy link
Contributor

Fixes #59

Added an internal var on UIColor that matches NSColor.alphaComponent

@1ec5 👀

@frederoni frederoni requested a review from 1ec5 April 19, 2017 10:06

let path = Path(coordinates: coordinates)
path.fillColor = UIColor.red.withAlphaComponent(0.5)
path.strokeColor = UIColor.green.withAlphaComponent(0.5)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be able to drop UIColor here but apparently, a type cannot be inferred with a subsequent method call.

@@ -27,6 +27,19 @@ internal extension Color {

return NSString(format: "%02x%02x%02x", Int(r), Int(g), Int(b)) as String
}

#if os(iOS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition causes the macOS, tvOS, and watchOS builds to fail. Both NSColor and UIColor have the same getRed(_:green:blue:alpha:) method, so conditionalizing this code on iOS should be unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS has its own alphaComponent so !os(macOS) should do the trick.

@frederoni frederoni merged commit 965daaf into master Apr 20, 2017
@frederoni frederoni deleted the fred-alpha branch April 20, 2017 08:56
@1ec5 1ec5 mentioned this pull request May 30, 2017
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

Successfully merging this pull request may close these issues.

2 participants