Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bsudekum/react-native-color-grabber
React native component for finding dominant colors in an image
https://github.com/bsudekum/react-native-color-grabber
Last synced: 6 days ago
JSON representation
React native component for finding dominant colors in an image
- Host: GitHub
- URL: https://github.com/bsudekum/react-native-color-grabber
- Owner: bsudekum
- Created: 2015-08-12T04:22:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-12T21:09:23.000Z (almost 8 years ago)
- Last Synced: 2024-09-15T19:21:16.361Z (3 months ago)
- Language: Objective-C
- Size: 89.8 KB
- Stars: 76
- Watchers: 7
- Forks: 8
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
- awesome-react-native - react-native-color-grabber ★57 - React native component for finding dominant colors in an image (Components / Media)
- awesome-react-native - react-native-color-grabber ★57 - React native component for finding dominant colors in an image (Components / Media)
- awesome-react-native - react-native-color-grabber ★57 - React native component for finding dominant colors in an image (Components / Media)
- awesome-react-native - react-native-color-grabber ★57 - React native component for finding dominant colors in an image (Components / Media)
- awesome-react-native-ui - react-native-color-grabber ★31 - React native component for finding dominant colors in an image (Components / Media)
README
## 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
```js
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:
![](https://cldup.com/73LEp_q3UE.gif)> Creating a map style from the dominant colors in an image
### Notes
* Only tested with images from `assets-library://`
* [Code from](http://stackoverflow.com/a/29266983/1522419)