What would be the easiest way to transform
$(\'#my_element\').css(\'backgroundColor\')
to object like this:
{ r: red_value,
Simple function to extract the RGB numeric values
function extractRgb (css) { return css.match(/[0-9.]+/gi) } console.log(extractRgb('rgb(255, 255, 255)')) console.log(extractRgb('rgba(255, 255, 255, 0.7)'))