Alternating row colours in a Tree

Is there any way to dynamically colour alternating rows in a Tree so that you always get consistent alternating rows when branches are opened or closed?

Greetings!

It’s possible to iterate through opened nodes of the tree (both parent and child) with eachOpen method and depending on the item position set the nessesery color. Here is an example: Code Snippet

Thanks. It also needed an onAfterRender handler to handle resizing.