Skip to content

Instantly share code, notes, and snippets.

View kaspermeyer's full-sized avatar

Kasper Meyer kaspermeyer

View GitHub Profile
getHexColor = (color) ->
return "" unless color
return color if /^#/.test(color)
rgbValues = getRGBValues(color)
hexValues = rgbValues.map(numberToHex)
"#" + hexValues.join("")
numberToHex = (number) ->
"0#{number.toString(16)}".slice(-2).toUpperCase()