I also would suggest using classes, but if you really want to know the color of something I would use a javascript library to parse the return from .css, like this one: http://www.phpied.com/rgb-color-parser-in-javascript/
Here is an example of it in use: http://jsfiddle.net/keegan3d/5SBpk/