LearnBoost/stylus — Issue #581: It's very hard to get full (i.e. uncompressed colors)
Author: richtera
Created: 2012-02-21 14:57:17+00:00
State: open

I know IE is not the primary thing but in order to use IE filters color compression needs to be turned off for those values.
I wrote this code which seems pretty cumbersome. There should be a built-in function for this. I guess I could fork and add it but for now I am just working on a prototype and this should be fine.

digit(v)
return "0" if v == 0
return "1" if v == 1
return "2" if v == 2
return "3" if v == 3
return "4" if v == 4
return "5" if v == 5
return "6" if v == 6
return "7" if v == 7
return "8" if v == 8
return "9" if v == 9
return "A" if v == 10
return "B" if v == 11
return "C" if v == 12
return "D" if v == 13
return "E" if v == 14
return "F" if v == 15

hex(n)
h = round(abs(n) / 16) % 16
l = n % 16
digit(h) + digit(l)

fullcolor(x)
"#" + hex(red(x)) + hex(green(x)) + hex(blue(x))

/* Vertical Background Gradient */
vbg-gradient(fc = #FFFFFF, tc = #FFFFFF)
background: fc
background: -webkit-gradient(linear, left top, left bottom, from(fc), to(tc))
background: -moz-linear-gradient(top, fc, tc)
background: linear-gradient(top, fc, tc)
add-property(filter, s('progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=%s, endColorstr=%s);', fullcolor(fc), fullcolor(tc)));
add-property(-ms-filter, s('progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=%s, endColorstr=%s);', fullcolor(fc), fullcolor(tc)));