views:

83

answers:

2

I'm using a jquery plugin that seems to need the color in "000000" format but when I do this:

currentcolor = $("#" + dividediting).css("background-color");

I get the output as:

rgb(0,0,0)

I'm wondering if there is a way to change the way it outputs or if I have to use regex to parse the result to get it to the needed format.. thanks for any advice

+1  A: 

This is the browser returning the parsed and processed colour value, it's got nothing to do with jQuery as such.

If you need to convert the value, see this question

rgb(x,z,y) is valid CSS as well, though.

Pekka
+1  A: 

Im not sure if there is a build-in javascript library to do this, but if you can parse that string to obtain the RGB values, you can get the HEX value (#XXXXXX) with something like this.

Dutchie432