React native component for finding dominant colors in an image
Objective-C
Switch branches/tags
Nothing to show
Clone or download
Latest commit bb155ab Aug 13, 2015
Permalink
Failed to load latest commit information.
color-grabber xcode didn't update code Aug 12, 2015
package.json add repo Aug 13, 2015
readme.md fix gif Aug 12, 2015

readme.md

React native color grabber

Given an image, returns dominant colors

Install:

  1. npm install react-native-color-grabber --save
  2. Add node_modules/color-grabber/color-grabber to your project
  3. Run and build

api

var colorGrabber = require('react-native').NativeModules.colorGrabber
colorGrabber.getColors(image, (err, res) => {
    console.log(res);
    // Returns:
    // {
    //  'UIDeviceRGBColorSpace 0.0784314 0.0941176 0.0823529 1': '0.1666667',
    //  'UIDeviceRGBColorSpace 0.215686 0.203922 0.262745 1': '0.1666667',
    //  'UIDeviceRGBColorSpace 0.517647 0.45098 0.380392 1': '0.6666667'
    // }
});

Example:

Creating a map style from the dominant colors in an image

Notes

  • Only tested with images from assets-library://
  • Code from