Coloring a waveform with spectral centroid or by other means
You can try first the following (no segmentation):


Process the signal in small chunks (say 10ms to 50ms in duration) - if necessary with a 50% overlap between them.
Compute the spectral centroid on each chunk.
Apply a non-linear function to the spectral centroid value to get a uniform distribution of the palette color used. Logarithm is a good start. Another option is to compute first the distribution of the centroid value other the entire file, and then color according to percentiles of this distribution (CDF). This adaptive approach guarantees that each color in the palette will be used in equal proportion. The drawback is that what is plotted in blue in one file won't be similar sounding to what is plotted in blue in another file if this adaptive approach is used!


It is not clear from the picture if Serato does this, or indeed goes one step further and attempts to segment the signal - it might not be surprising that it does since knowing the instants at which notes are present in a music signal can help synchronizing them! The steps would be:


Compute a Short-Term Fourier Transform (spectrogram) of the signal - using the FFT on short overlapping segments (start with a FFT size of 1024 or 2048 with 44.1kHz audio).
Compute an onset-detection function. I recommend you to look at this paper - the proposed approach is very effective and even a C++ implementation takes less than 10 lines. You can find an implementation in Yaafe - as ComplexDomainOnsetDetection.
Detect peaks in the onset-detection function to get the position of note onsets.
Compute the spectral centroid over all the time segments delimited by the detected onsets (don't forget to window and/or zero-pad!)
And don't forget the non-linear map! Note that the gradient-effect that appear between each note on the Serato waveform might be artificially generated.


Once you get this working, a "low hanging fruit" would be to compute a few other features on each segment (moments, a handful of MFCCs...), run k-means on these feature vectors, and decide on the color of the segment using the cluster index. See section II of Ravelli's paper.