Expand|Select|Wrap|Line Numbers
- var str = "rgb(51, 45, 32)"
- var first = str.slice(4,6);
- var second = str.slice(8,10);
- var third = str.slice(12,14);
- var integOne = parseInt(first);
- var integTwo = parseInt(second);
- var integThree = parseInt(third);
- ctx.fillStyle = "rgba(integOne, integTwo, integThree, 0.5)";
I tried the following, but without success:
Expand|Select|Wrap|Line Numbers
- var str = "rgb(51, 45, 32)";
- var strSliced = str.slice(4,14);
- eval("ctx.fillStyle = 'rgba("+strSliced+", 0.5)'");
Cheers.