The Wayback Machine - https://web.archive.org/web/20201014155122/https://github.com/kkdevenda/UIImageColors
Skip to content
master
Go to file
Code
This branch is 114 commits behind jathu:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.md

UIImageColors

iTunes 11 style color fetcher for UIImage. This is an almost identical port of Panic's OS X ColorArt for iOS Swift.

In other words, it fetches the most dominant and prominent colors.

preview

Documentation

This is pretty simple to use:

let image = UIImage(named: "hello.png")
let colors = image.getColors()

backgroundView.backgroundColor = colors.backgroundColor
mainLabel.textColor = colors.primaryColor
secondaryLabel.textColor = colors.secondaryColor
detailLabel.textColor = colors.detailColor

UIImage Methods

  • getColors(scaleDownSize: CGSize) -> UIImageColors

Get an UIImageColors struct from the image. Use smaller sizes for better performance at the cost of quality colors. Use larger sizes for better color sampling and quality at the cost of performance.

  • getColors() -> UIImageColors

Get an UIImageColors struct from the image. The default image scale down is 250px width, and the aspect ratio height.

  • resize(newSize: CGSize) -> UIImage

Resize your image.

UIImageColors

UIImageColors simply contains four different UIColor.

  • backgroundColor -> UIColor
  • primaryColor -> UIColor
  • secondaryColor -> UIColor
  • detailColor -> UIColor

UIColor Methods

As a result of testing colors for certain properties, UIColor get's some cool extensions. The functions are self-explanatory.

  • isDarkColor -> Bool
  • isBlackOrWhite -> Bool
  • isDistinct(compareColor: UIColor) -> Bool
  • colorWithMinimumSaturation(minSaturation: CGFloat) -> UIColor
  • isContrastingColor(compareColor: UIColor) -> Bool

License

Feel free to do whatever you want. Please include the original header in any modifications or redistributions.


June 2015 - Toronto

About

iTunes 11 style color fetcher for UIImage.

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.