This cool video shows how to use a posterized gradient to make a set of tonal rectangles.
Add a horizontal (O°) gradient adjustment layer running from one tonality or color to another.
Add a posterize adjustment layer. It’s property panel lets you set the number of separate tones/colors in the gradient. An odd number guarantees 50% grey somewhere.
Clip the posterize layer to the gradient layer.
This is really cool.
More can be found here, including a downloadable action.