Works on multiples of eight stitches. Add four more stitches if you want your piece to end with the same color it starts with.
Row one: Knit four in color one, knit four in color two. Repeat across row. If you knit this on a straight multiple of eight stitches, you'll end with color two, as pictured. If you add four more stitches you can end in color one and give your project more symmetry.
Row two: Purl four in the same color you ended the last row with, purl four in the other color. Repeat across row.
This type of stitch can really be done with any number of stitches, such as three for each color or five for each color. You could also make uneven vertical stripes in this manner; for instance two stitches of color one and four stitches of color two.
When working with two colors like this, you're doing what's known as stranded knitting. For best results, keep your strands loose across the back of the work, and always pick up your next color thread from underneath the thread you were just working with.
Colored rib benefits from a light blocking when finished.