was.js – Diff between revs 7 and 8

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 7 Rev 8
Line 1... Line 1...
1 /*************************************************************************/ 1 /*************************************************************************/
2 /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ 2 /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */
3 /*************************************************************************/ 3 /*************************************************************************/
4 function HexToRGB(hex) { 4 function wasHexToRGB(hex) {
5 var shortRegEx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; 5 var shortRegEx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
6 hex = hex.replace( 6 hex = hex.replace(
7 shortRegEx, 7 shortRegEx,
8 function(m, r, g, b) { 8 function(m, r, g, b) {
9 return r + r + g + g + b + b; 9 return r + r + g + g + b + b;
10 } 10 }
11 ); 11 );
12 12  
13 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 13 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
14 return result ? { 14 return result ? {
15 r: parseInt(result[1], 16), 15 r: parseInt(result[1], 16),
16 g: parseInt(result[2], 16), 16 g: parseInt(result[2], 16),
17 b: parseInt(result[3], 16) 17 b: parseInt(result[3], 16)
18 } : null; 18 } : null;
19 } -  
20   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 }
-   32