In Scratch Set Pen Color to RGB is normally defined as: set pen color to ((red*65536)+(blue*256)+green) In fact this is a shortcut for a left shift operation set pen color to (red << 16 | green << 8 | blue) This creates a 24 bit binary number composed of red, green and blue values. Each value is an 8 bit integer {0-255}. Red is bits 16-23, green is bits 8-15 and blue is bits 0-7. Left shift (<<) The left shift operator (<<) shifts the first operand the specified number of bits to the left. Excess bits shifted off to the left are discarded. Zero bits are shifted in from the right. If red, green or blue is 255 the binary representation is 11111111 therefore: red << 16: 111111110000000000000000 blue << 8: 000000001111111100000000 green: 000000000000000011111111 color: 111111111111111111111111