# Color, RGB and Bit numbers

Hi, I have been playing around with this code at wonderfl. I can not find anywhere what this section of code means (I found it hard to search because of funny >> symbols).

Please could anyone enlighten me on what the color modification is actually doing line by line… The overall effect is an ‘addative’ blend (e.g. lots of particles on one pixel will make it white) but I’m not sure what the stuff in the lines means and why is r>>16 and g>>8 ?

The link is here, lines 300-306: http://wonderfl.net/code/e14259ff3fed2a9bcc58f3d9bb17fd586c940b8b

The lines in question:

``````col = canvas.getPixel(int(prt.x), int(prt.y));
r = (col>>16&0xff) + prt.r*colTransR;
g = (col>>8&0xff) + prt.g*colTransG;
b = (col&0xff) + prt.b*colTransB;
r = (r<0xff)? r : 0xff;
g = (g<0xff)? g : 0xff;
b = (b<0xff)? b : 0xff;
canvas.setPixel(int(prt.x), int(prt.y), (r<<16)|(g<<8)|b);
``````

Any help is greatly appreciated :). Also if you could tell me where I can learn this myself (books or websites) I would love that instead of using people’s time here xD,
Dan