title: Compare context strokestyle and rbg of a pixel in canvas
body: <p>i want a function which checks the color of stroke and pixel in canvas. If the color of pixel in canvas and stroke is same, then do not change the color of the stroke. I have tried the function below but it doesn't work. Any idea how to achieve this? thanks</p>
  
  <pre><code>//this line gets pixel data
  pixels = context.getImageData(0, 0, canvas.width, canvas.height);
  var linecolor = context.strokeStyle;
  if ((linecolor) === (colour.r &amp;&amp; colour.g &amp;&amp; colour.b)){
      context.strokeStyle = "rgb(255,255,0)"
      }
  
      function getpixelcolour(x, y) {
      var index = ((y * (pixels.width * 4)) + (x * 4));
      return {
      r: pixels.data[index],
      g: pixels.data[index + 1],
      b: pixels.data[index + 2],
      a: pixels.data[index + 3]
      };
  }
  </code></pre>