Change Embedded Note's Title's Colour According to Depth

What I’m trying to do

I embed notes into others in an attempt to have atoms of information as opposed to one big note on a large topic. As a consequence, notes for those larger topics are composed of many nested embedded notes.

I’d like to change the colour of an embedded note’s title according to its degree of “embeddedness” relative to the note you’re viewing it from.

For example in this image, I would like the embedded note title “Wavelength Selector” to be orange, and since “Prisms” and “Diffraction Gratings” are at the same embedding “depth” they should both be green, and lastly “Refraction” would be blue.

I would personally be using just those three colours alternating through the sequence: orange, green, blue. If going through the sequence isn’t possible maybe going down a gradient would, or if neither of those are possible maybe just changing the line that indicates an embed on the left would work. I’m really looking for a way to make the depth noticable.

Things I have tried

I’m not sure where to start with this but I was originally using the Style Settings plugin with the Minimalist Theme to colour my headings.