Latest 0.0.1
License MIT
Platforms ios 9.0

0.1 TODO

Please open an issue if you want some new feature.

0.2 Change Log

  1. The iOSPalatte framework is a static framework,To avoid fail to load the category.You should add "-all_load" to your target "other linker flag" in the building settings.

  2. Fix the memory leak.

  3. When you use the default API:"getPaletteImageColor",you will get a null "allcolorDic" in your callback block.

  4. "Showing the percentage of every color".Due to the issue.


Objective-C version of Google Palette algorithm in Java.A tool to extract the main color of a image.Compare to traditional algorithm,iOSPalette can help you extract the main color which is more likely to be "The Main Color".It is not always the largest in pixel numbers.

For Chinese user,you can tap the article iOS图片精确提取主色调算法iOS-Palette.It will be helpul.

2.Why iOS-Palette

1.It always help you to extract the color you want,no the largest in the pixel count.Just like this case:

You can see the 6 TargetMode from the demo screenshot.They are distinguished by different Saturation and Lightness (According to HSL Color Mode).

LIGHT_VIBRANT_MODE (High Lightness , High Saturation)

VIBRANT_MODE(Normal Lightness , High Saturation)

DARK_VIBRANT_MODE(Dark Lightness , High Saturation)

LIGHT_MUTED_MODE(High Lightness , Low Saturation)

MUTED_MODE(Normal Lightness , Low Saturation)

DARK_MUTED_MODE(Dark Lightness , Low Saturation)

You can get every target mode color thourgh the iOSPalette API if you need!

##### 2.It helps to combine every single RGB Value into a VBox,then calculate the most representational color.

# 3.How to use iOS-Palette

You can get these simple API in Palette.h and UIImage+Palette.h:

If you need all target mode info, you can use these API in Palette.h and UIImage.Palette.h:

Then you all get the callback with all color infomation you want:

Tips:The recommendColor is the color for the vibrant target.In case of null,It will be replaced by this order:MUTE_MODE——LIGHT_VIRANT_MODE ——LIGHT_MUTE_MODE——DARK_VIBRANT_MODE——DARK_MUTE_MODE.

Absolutely,you can change the order if you want different performance.

# 4.Demo
1.Before white background:

2.In the normal illumination:

# 5.Contact me

if you have any question,you can contact me thourgh the contact infomation below.Or open a issue on Github.I will solve it as soon as possible!Best wishes!


Email:[email protected]

简书:[Tap Here](

Latest podspec

    "name": "iOSPalette",
    "version": "0.0.1",
    "summary": "iOS Palette",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "ChaselAn": "[email protected]"
    "platforms": {
        "ios": "9.0"
    "source": {
        "git": "",
        "tag": "0.0.1"
    "source_files": "iOSPalette/iOSPalette/Source/*"

Pin It on Pinterest

Share This