This question already has an answer here:
how to got connect to css/html and get the current color of a div and then save it as a variable for further work in java script? e.g. there is a red element on your html page and you want to find its color then save it as a variable in js.