Swiftpack.co - Package - ddddxxx/ColorArtwork

ColorArtwork

Build Status supports platforms License codebeat badge

Swift-based iTunes 11-style color matching code. Inspired by Panic Blog.

preview

Requirements

  • macOS 10.10+ / iOS 9.0+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 8+
  • Swift 3.0+

Installation

Carthage

Add the project to your Cartfile:

github "ddddxxx/ColorArtwork"

Swift Package Manager

Add the project to your Package.swift file:

let package = Package(
    dependencies: [
        .Package(url: "https://github.com/ddddxxx/ColorArtwork", majorVersion: 0)
    ]
)

Usage

import ColorArtwork
// IMAGE: UIImage / NSImage / CGImage
//      UIImage -> UIColor
//      NSImage -> NSColor
//      CGImage -> CGColor
// SIZE: scale down size before analyzing
//      nil(default): auto scale
//      zero: do not scale
let (backgroundColor, primaryColor, secondaryColor, detailColor) = IMAGE.getProminentColors(scale: SIZE)

License

ColorArtwork is available under the MIT license. See the LICENSE file.

Github

link
Stars: 13
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

v0.3.0 - Feb 28, 2017

Extension for CGImage, NSImage and UIImage!

Features

  • get colors from images directly
  • return non-optional color

BREAKING CHANGES

  • Privatize CAColorArtwork class

v0.2.0 - Feb 26, 2017

7x times faster!!! (for 600*600 testing artwork)

Feature

  • scale image before analyzing
  • filtrate colors with background color before sorting
  • use UnsafePointer instead of Data

Fixes:

  • incorrect edge color counting