Converting integers to hex string in JavaScript
To convert a number to hex, you can use the built-in toString(16) function. Simple code:
function convert(integer) {
var str = Number(integer).toString(16);
return str.length == 1 ? "0" + str : str;
};
function to_rgb(r, g, b) { return "#" + convert(r) + convert(g) + convert(b); }
var color = to_rgb(r, g, b);
Just use the RGB values, like:
this.context.fillStyle = "rgb(0,255,255)";