It would seem more natural to specify the number of colours on a single side. That would get rid of the "must be odd" requirement, and the undefined behaviour when even. (Failing that, the function should at least check the value and throw an error if even.)

Currently the usage is `n_layers=len(contour_levels) - 1` which is not particularly clean. Replacing it with `n_layers=4` would be no worse.