My knowledge of CSS and how to actually achieve this ran out. Getting the information into a session property is easy, but I have no idea how to animate that dock colour using the style sheet.
I'll have to think about this for awhile, but I don't think you'll be able to manage this. The problem you'll run into is going to be changing the color based on a session state, but our built-in Session pieces (Docked Views, Popups, Notifications) don't allow for specifying their styling/appearance based on conditions because there's nothing in the Designer aside from behavioral configurations.
I think your best option is going to be to use a changeScript on session.props.auth.username and when the value is not None or an empty string use system.perspective.alterDock() to modify the Docked View.
Ah, yah, we don't even expose the color during Docked View configuration. I'll try to remember to open a feature request for this when I am next in the office. For now, I don't see an avenue to achieve this.
If you use the stylesheet.
It could be done with only css if you have this thing
(Idk if it works if you turned this off, i know its possible to turn it off but i forgot where so cant test)