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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    12
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    12
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i canvas-pixel-color

Weekly Downloads

12

Version

1.0.2

License

MIT

Last publish

Collaborators

  • meandave