Select Page

Color Cube

This color cube represents three color dimensions (red, blue, green) of each dot (pixel) on a screen. Three corners of the cube are red, green, and blue. Three other corners are mixtures of either red-green, red-blue, green-blue. It seems intuitive that red and blue mixed together make violet, but green and red light mixed together make yellow! Keep in mind that these are mixtures of red and green light, not red and green pigment as in paint or colored clay.

One corner of the cube mixes all three colors (resulting in white). When you mix all colors (different wavelengths of light) you get white (left). The corner opposite to the white corner has no colors, and so is black (absence of all light, shown on the right).

We can make each side of the cube in Scratch. Click here. The code gives each pixel one increment more of a color for each step in a direction. For example, in one square we gave pixels one increment more red as we moved a step (one pixel) to the right, and added one increment more green as we moved one pixel higher. You can make all six sides of the color cube this way. Then join all squares side by side. We did this to make our color cubes in your subscription box.

We show just some of the code below.  Some of this code is just to translate the usual scratch code for color into the standard RGB code, which uses three numbers: one for red, one for green and one for blue, each ranging from 0 to 255 (256 values). This is the standard way computers code for RGB for the pixels on a screen.

This cube is a model of how computers use code to generate a wide range of colors. Think of each color as a dimension in space, as on an x, y and z axis. On this screen you will see just 2 dimensions, for example red going from zero red to maximum red along the x axis and green going from zero to maximum along the y axis. We also have a z axis for the third color, and so a full three-dimensional cube of colors. By printing and pasting all six possible squares together, we put together the color cube you find in your box.