Skip to content

zzetao/react-native-extract-color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-extract-color npm

Extract colors from an image

Usage

import ExtractColor from 'react-native-extract-color';

try {
  const colors = await ExtractColor.extract('/Users/zzetao/xx/../xx/LocalImagePath.png');
  /*
    colors:
    {
      primaryColor: '#hex',
      backgroundColor: '#hex',
      secondaryColor: '#hex',
      detailColor: '#hex'
    }
  */
} catch(e) {
  console.warn('error: ', e);
}

Getting started

$ yarn add react-native-extract-color

Mostly automatic installation

$ react-native link react-native-extract-color

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-extract-color and add RNExtractColor.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNExtractColor.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)

License

Copyright © 2018, zzetao. Released under the MIT License.