Работа с цветом

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

htmlColor = "#%.02X%.02X%.02X" % [
    red, green, blue]
# htmlColor is #33FF33
puts "htmlColor is #{htmlColor}"

# with transparency
htmlColor += alpha.to_s(16)
# htmlColor is #33FF3380
puts "htmlColor is #{htmlColor}"