canvas-pixel-color

1.0.2 • Public • Published

Canvas-pixel-color

NPM

pass an event and canvas context and get back rgba and hex data.

Usage

var canvasPixelColor = require('canvas-pixel-color');
var cvs = document.getElementById('myCanvas');
var ctx = cvs.getContext('2d');
 
cvs.addEventListener('mousemove', function(ev) {
  // returns {
  //   hex: ##ff0beb,
  //   rgba: [255, 11, 235, 115] // this is an actual Array
  // }
  console.log(canvasPixelColor(ev, ctx));
});
 

Info

This is basically just pulled from canvas-color-picker. With some slight changes.

License

(same as original project's) MIT License

Package Sidebar

Install

npm i canvas-pixel-color

Weekly Downloads

13

Version

1.0.2

License

MIT

Last publish

Collaborators

  • meandave