I have a
try parseInt(hex,16) to convert hex string into decimal int
so in this case it'll be:
var color = '#abcdef';
var rgbaCol = 'rgba(' + parseInt(color.slice(-6,-4),16)
+ ',' + parseInt(color.slice(-4,-2),16)
+ ',' + parseInt(color.slice(-2),16)
+',0.5)';
$('div').css('background-color', rgbaCol)
you should create a function out of this to use in your application.