JSFiddle - React, Tailwind, and code Playground
by Jim_Toth
HTML
<input id="foo" type="text" name="fname">
JavaScript
function convertHex($$hex,$$opacity){
$$hex = $$hex.replace('#','');
$$r = parseInt($$hex.substring(0,2), 16);
$$g = parseInt($$hex.substring(2,4), 16);
$$b = parseInt($$hex.substring(4,6), 16);
$$result = 'rgba('+$$r+','+$$g+','+$$b+','+$$opacity/100+')';
return $$result;
}
$('#foo').val(convertHex('#ffffff',75));