Search code examples
htmlcanvaspixel

Insert a single pixel into HTML5 canvas


I want to insert a pixel with a color, and I use this code:

context.fillStyle='RGB('+s[i]+')';
context.fillRect(i,y,1,1)

Is there a shorter way to do it? e.g. in a single line of code? My main goal is to reduce the amount of code.


Solution

  • fillStyle="rgb("+a[m];
    fillRect(m,o,1,1);
    

    Someone did with that :P