let red = 51
let green = 255
let blue = 51
let alpha = 128
let value = (red << 16) + (green << 8) + blue
let htmlColor = ("0" + value.toString(16))
.slice(-6)
//htmlColor is #33ff33
console.log(`style="color: #${htmlColor}"`)
//with transparency
value = (value << 8) + alpha
htmlColor = ("0" + value.toString(16))
.slice(-8)
//htmlColor is #3ff3380
console.log(`htmlColor is #${htmlColor}`)