Really what that’s doing is something like the Posterize filter in Photoshop / Gimp. You can play with the colorSteps number until you get something you like, but you may get some odd color shifting between the bands if you do it like that.
The better option may be too convert the color from RGB to HSV and apply the steps to that. You won’t get the odd color shifting, but it still won’t look quite like what your example is as it’ll have separate stepping for the hue, saturation, and brightness.
To really get something like what your example image shows requires doing the color interpolation in the fragment shader, and adjusting the steps of the interpolation factor. That means the shader gets the 3 color values, then you store the blend amount from one color to the next either as a UV or a single vertex color channel (like alpha, where 0 is the first color, 127 is the next, 255 is the third) and pass that from the vertex shader to the fragment shader. Then do a lerp() between the colors with a (rescaled) stepped version of that value.