Skip to content

Instantly share code, notes, and snippets.

@FranciscoG
Forked from adunkman/gist:2580972
Last active August 29, 2015 14:04
Show Gist options
  • Save FranciscoG/debbe60102859e46be9e to your computer and use it in GitHub Desktop.
Save FranciscoG/debbe60102859e46be9e to your computer and use it in GitHub Desktop.
// source: https://gist.github.com/adunkman/2580972
// background transparency
background-transparency(hexColor, alpha = 1)
ms-color = argb(hexColor, alpha)
background hexToRgb(hexColor)
background rgba(hexColor, alpha)
.mod-no-rgba &
*zoom 1
background transparent
filter s('progid:DXImageTransform.Microsoft.gradient(startColorstr=%s,endColorstr=%s)', ms-color, ms-color)
&:nth-child(n)
filter none
// convert a decimal to hex
hex(decimal)
hex-value = ('0') ('1') ('2') ('3') ('4') ('5') ('6') ('7') ('8') ('9') ('A') ('B') ('C') ('D') ('E') ('F')
unquote(hex-value[floor(decimal / 16)] + hex-value[floor(decimal % 16)])
// convert to old 8-digit MS hex value where first 2 digits are the Alpha hex value
argb(color, alpha = 1)
s('#%s%s', hex(alpha * 255), color)
// convert hex colors to RGB
hexToRgb(hexColor)
s('rgb(%s, %s, %s)', red(hexColor), green(hexColor), blue(hexColor))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment