-
Notifications
You must be signed in to change notification settings - Fork 0
/
jwee-css.js
46 lines (26 loc) · 969 Bytes
/
jwee-css.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//////////////////////////////////////////////////////////////////////////
// JWee JavaScript Framework & Toolkit
// Copyright (c) 2010 AUTHORS ([email protected])
// Licensed under the MIT and GPL (for now).
// http://www.jwee.org
//////////////////////////////////////////////////////////////////////////
// ** UNDER CONSTRUCTION **
//////////////////////////////////////////////////////////////////////////
(function() {
wee.css = {};
wee.css.rgb2Hex = function() {
var args = $a(arguments), len = args.length, hex = [], i, bit;
if( len === 1 ) {
if( typeof args[0] == 'string' ) args = args[0].match(/\d+/g);
else args = args[0];;
}
if (args.length < 3) return null;
if (args.length == 4 && args[3] == 0 && !array) return 'transparent';
for (i = 0; i < 3; i++){
bit = (args[i] - 0).toString(16);
hex.push((bit.length == 1) ? '0' + bit : bit);
}
return '#' + hex.join('');
};
})();
})();