处理颜色

val red = 51 
val green = 255
val blue = 51
val alpha = 128

val value = red * 65536 + green * 256 + blue
var htmlColor = "#" + Integer.toHexString(value)
//htmlColor is #33ff33
println("style=\"color: $htmlColor\"")

//with transparency
val format = HexFormat {
    upperCase = true
    number {
        removeLeadingZeros = true
    }
}

htmlColor = "#" +
    red.toHexString(format) +
    green.toHexString(format) +
    blue.toHexString(format) +
    alpha.toHexString(format)
//htmlColor is #33FF3380
println("htmlColor is $htmlColor")