corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 /*************************************************************************/
2 /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
3 /*************************************************************************/
4 function wasHexToRGB(hex) {
5 var shortRegEx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
6 hex = hex.replace(
7 shortRegEx,
8 function(m, r, g, b) {
9 return r + r + g + g + b + b;
10 }
11 );
12  
13 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
14 return result ? {
15 r: parseInt(result[1], 16),
16 g: parseInt(result[2], 16),
17 b: parseInt(result[3], 16)
18 } : null;
19 }
20  
21 /*************************************************************************/
22 /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
23 /*************************************************************************/
24 function wasRGBToHex(r, g, b) {
25 return "#" + (
26 (1 << 24) +
27 (r << 16) +
28 (g << 8) +
29 b
30 ).toString(16).slice(1);
31 }