add themed colored elements

This commit is contained in:
rlx 2011-10-26 14:52:03 +00:00
commit 188656bd99
5 changed files with 147 additions and 130 deletions

View file

@ -97,4 +97,23 @@ Ox.rgb = function(hsl) {
return rgb.map(function(v) {
return v * 255;
});
};
};
/*@
Ox.toHex <f> Format RGB array as hex value
@*/
Ox.toHex = function(rgb) {
return rgb.map(function(val) {
return Ox.pad(val.toString(16).toUpperCase(), 2);
}).join('');
};
/*@
Ox.toRGB <f> Format hex value as RGB array
@*/
Ox.toRGB = function(hex) {
return Ox.range(3).map(function(i) {
return parseInt(hex.substr(i * 2, 2), 16);
});
};