Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (38 sloc) 973 Bytes
<!doctype html>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<style type="text/css">
<div class="canvasContainer">
<canvas id="canvas" width="400" height="400"></canvas>
<div class="color">
<div id="showColor"></div>
<script type="text/javascript">
var img = new Image();
img.src = '1.png';
var oc = document.getElementById('canvas');
var content = oc.getContext('2d');
img.onload = function(){
var color = document.getElementById('showColor');
function pick(event){
var x = event.layerX;
var y = event.layerY;
var pixels = content.getImageData(x,y,1,1);
var data =;
var rgba = 'rgba('+data[0]+','+data[1]+','+data[2]+','+data[3]+')'; = rgba;
color.innerHTML = rgba;
You can’t perform that action at this time.