You may find working example and details here:

https://github.com/Inflectra/rapise-powerpack/tree/master/GetDOMElementColor