Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #68 from boyvanamstel/macos
Browse files Browse the repository at this point in the history
Add support for macOS
  • Loading branch information
jathu authored Feb 10, 2019
2 parents 5508ab5 + 9676328 commit a1338fc
Show file tree
Hide file tree
Showing 13 changed files with 406 additions and 77 deletions.
24 changes: 24 additions & 0 deletions NSImageColors/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 Jathu Satkunarajah. All rights reserved.</string>
</dict>
</plist>
19 changes: 19 additions & 0 deletions NSImageColors/NSImageColors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// NSImageColors.h
// NSImageColors
//
// Created by Boy van Amstel on 20/01/2019.
// Copyright © 2019 Jathu Satkunarajah. All rights reserved.
//

#import <Cocoa/Cocoa.h>

//! Project version number for NSImageColors.
FOUNDATION_EXPORT double NSImageColorsVersionNumber;

//! Project version string for NSImageColors.
FOUNDATION_EXPORT const unsigned char NSImageColorsVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <NSImageColors/PublicHeader.h>


47 changes: 29 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
![platform: iOS, tvOS and macOS](https://img.shields.io/badge/platform-iOS%20%7C%20tvOS%20%7C%20macOS-lightgrey.svg)

# UIImageColors

iTunes style color fetcher for UIImage. It fetches the most dominant and prominent colors.
iTunes style color fetcher for `UIImage` and `NSImage`. It fetches the most dominant and prominent colors.

![preview](preview.png)

## Installation

You can either directly copy [UIImageColors.swift](Sources/UIImageColors.swift) into your project *or* you can use CocoaPods: [UIImageColors](https://cocoapods.org/pods/UIImageColors).
### Manual

Copy [UIImageColors.swift](Sources/UIImageColors.swift) into your project.

### [Cocoapods](https://cocoapods.org)

Add UIImageColors to your [`Podfile`](https://cocoapods.org/pods/UIImageColors):

```
pod 'UIImageColors'
```

### [Carthage](https://github.com/Carthage/Carthage)

Add UIImageColors to your `Cartfile`:

```
github "jathu/UIImageColors"
```

## Example

Expand Down Expand Up @@ -34,27 +54,18 @@ secondaryLabel.textColor = colors.secondary
detailLabel.textColor = colors.detail
```

## UIImage Methods

```swift
getColors() -> UIImageColors
```

```swift
getColors(quality: UIImageColorsQuality) -> UIImageColors
```

```swift
getColors(_ completion: (UIImageColors) -> Void) -> Void
```
## Image Methods

```swift
getColors(quality: UIImageColorsQuality, _ completion: (UIImageColors) -> Void) -> Void
getColors() -> UIImageColors?
getColors(quality: ImageColorsQuality) -> UIImageColors?
getColors(_ completion: (UIImageColors?) -> Void) -> Void
getColors(quality: UIImageColorsQuality, _ completion: (UIImageColors?) -> Void) -> Void
```

## UIImageColors Objects

`UIImageColors` is struct that contains four different `UIColor` variables.
`UIImageColors` is struct that contains four different `UIColor` (or `NSColor` on macOS) variables.

```swift
public struct UIImageColors {
Expand Down Expand Up @@ -83,4 +94,4 @@ public enum UIImageColorsQuality: CGFloat {
The [license](https://github.com/jathu/UIImageColors/blob/master/LICENSE) is provided in the project folder. This is based on Panic's [OS X ColorArt](https://github.com/panicinc/ColorArt/#license).

------
June 2015 - Toronto
June 2015 - Toronto
9 changes: 5 additions & 4 deletions UIImageColors.podspec
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
Pod::Spec.new do |spec|
spec.name = "UIImageColors"
spec.version = "2.0.1"
spec.version = "2.1.0"
spec.license = "MIT"
spec.summary = "iTunes style color fetcher for UIImage."
spec.summary = "iTunes style color fetcher for UIImage and NSImage."
spec.homepage = "https://github.com/jathu/UIImageColors"
spec.authors = { "Jathu Satkunarajah" => "https://twitter.com/jathu" }
spec.source = { :git => "https://github.com/jathu/UIImageColors.git", :tag => spec.version }

spec.ios.deployment_target = "8.0"
spec.tvos.deployment_target = "9.0"
spec.source_files = "Sources/*.swift"
spec.macos.deployment_target = "11.0"
spec.source_files = "UIImageColors/Sources/*.swift"
spec.requires_arc = true
spec.pod_target_xcconfig = {
"SWIFT_VERSION" => "3.0"
"SWIFT_VERSION" => "4.2"
}
end
Loading

0 comments on commit a1338fc

Please sign in to comment.