Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-get-pixel-color

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-get-pixel-color

React Native Get Pixel Color

  • 1.1.0-alpha.23
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-native-get-pixel-color

npm version npm

Description

Get HEX color value from image in React Native. Works both for iOS and Android.

Getting started

$ npm install react-native-get-pixel-color --save

or

$ yarn add react-native-get-pixel-color

Important note

For iOS you should pass the path to the file, however for Android you should pass base64 string of the image. In the near future both implementations would be unified to both use only one of these options.

Usage (iOS)

import GetPixelColor from 'react-native-get-pixel-color';

// upload image
GetPixelColor.init(pathToFile)
  .then(() => {
    // your callback if needed
  })
  .catch(err => {
    // Handle errors
  });

// pick a color at X, Y
GetPixelColor.pickColorAt(x, y)
  .then((color) => {
    // HEX color value returned
  })
  .catch(err => {
    // Handle errors
  });

Usage (Android)

import GetPixelColor from 'react-native-get-pixel-color';

// upload image
GetPixelColor.init(base64)
  .then(() => {
    // your callback if needed
  })
  .catch(err => {
    // Handle errors
  });

// pick a color at X, Y
GetPixelColor.pickColorAt(x, y)
  .then((color) => {
    // HEX color value returned
  })
  .catch(err => {
    // Handle errors
  });

Disclaimer

At this moment iOS implementation of this module is forked from https://github.com/crispipear/react-native-pixel-color.

The main difference is that we upload an image only once and picking colors by coordinates as many times as we want. In the original implementation the new image was uploaded each time we want to pick 1 pixel

Keywords

FAQs

Package last updated on 20 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc