Skip to content
No description, website, or topics provided.
Swift Ruby Objective-C
Branch: master
Clone or download
Latest commit e7fb7ee Aug 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Framework
Source Fix swatches generation Aug 10, 2019
.gitignore Initial commit Aug 8, 2019
LICENSE Create LICENSE Aug 11, 2019
Palette.podspec
README.md Update README.md Aug 25, 2019

README.md

Palette

Color palette generation from image written in Swift.

Installation

Cocoapods:

pod 'Palette', :git => 'https://github.com/galandezzz/ios-Palette.git'

Carthage:

github "galandezzz/Palette" ~> 1.0

Usage

Targets

There are six built-in targets for palette generation:

  • Light vibrant
  • Vibrant
  • Dark vibrant
  • Light muted
  • Muted
  • Dark muted

You can also create your own targets using Target.Builder class:

let target = Target.Builder()
                .with(targetSaturation: 0.7)
                .with(targetLightness: 0.7)
                .build()

Synchronous Palette generation

let palette = Palette.from(image: YOUR_IMAGE).generate()
view.backgroundColor = palette.vibrantColor

or simply

view.backgroundColor = YOUR_IMAGE.createPalette().vibrantColor

Asynchornous Palette generation

Palette.from(image: YOUR_IMAGE).generate { view.backgroundColor = $0.vibrantColor }

or using extension on UIImage

YOUR_IMAGE.createPalette { view.backgroudColor = $0.vibrantColor }

License

Palette is available under the MIT license. See the LICENSE file for more info.

You can’t perform that action at this time.