UIImageColors is struct that contains four different UIColor (or NSColor on macOS) variables.
public struct UIImageColors {
public var background: UIColor!
public var primary: UIColor!
public var secondary: UIColor!
public var detail: UIColor!
}
UIImageColorsQuality is a enum with four different qualities. The qualities refer to how much the original image is scaled down. Lowest implies smaller size and faster performance at the cost of quality colors. High implies larger size with slower performance with good colors. Highest implies no downscaling and very good colors, but it is very slow.
The default is set to high.
public enum UIImageColorsQuality: CGFloat {
case lowest = 50 // 50px
case low = 100 // 100px
case high = 250 // 250px
case highest = 0 // No scale
}
License
The license is provided in the project folder. This is based on Panic’s OS X ColorArt.
UIImageColors
iTunes style color fetcher for
UIImage
andNSImage
. It fetches the most dominant and prominent colors.Installation
Manual
Copy UIImageColors.swift into your project.
Cocoapods
Add UIImageColors to your
Podfile
:Carthage
Add UIImageColors to your
Cartfile
:Example
Asynchronous example:
Synchronous example:
Image Methods
UIImageColors Objects
UIImageColors
is struct that contains four differentUIColor
(orNSColor
on macOS) variables.UIImageColorsQuality
is a enum with four different qualities. The qualities refer to how much the original image is scaled down.Lowest
implies smaller size and faster performance at the cost of quality colors.High
implies larger size with slower performance with good colors.Highest
implies no downscaling and very good colors, but it is very slow.The default is set to
high
.License
The license is provided in the project folder. This is based on Panic’s OS X ColorArt.
June 2015 - Toronto