was.js – Diff between revs 7 and 8
?pathlinks?
Rev 7 | Rev 8 | |||
---|---|---|---|---|
Line 193... | Line 193... | |||
193 | ); |
193 | ); |
|
194 | } |
194 | } |
|
Line 195... | Line 195... | |||
195 | |
195 | |
|
196 | /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ |
196 | /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ |
|
197 | /*************************************************************************/ |
197 | /*************************************************************************/ |
|
198 | function HexToRGB(hex) { |
198 | function wasHexToRGB(hex) { |
|
199 | var shortRegEx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; |
199 | var shortRegEx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; |
|
200 | hex = hex.replace( |
200 | hex = hex.replace( |
|
201 | shortRegEx, |
201 | shortRegEx, |
|
202 | function(m, r, g, b) { |
202 | function(m, r, g, b) { |
|
203 | return r + r + g + g + b + b; |
203 | return r + r + g + g + b + b; |
|
204 | } |
204 | } |
|
205 | ); |
205 | ); |
|
206 | |
206 | |
|
207 | var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); |
207 | var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); |
|
208 | return result ? { |
208 | return result ? { |
|
209 | r: parseInt(result[1], 16), |
209 | r: parseInt(result[1], 16), |
|
210 | g: parseInt(result[2], 16), |
210 | g: parseInt(result[2], 16), |
|
211 | b: parseInt(result[3], 16) |
211 | b: parseInt(result[3], 16) |
|
212 | } : null; |
- | ||
213 | } |
212 | } : null; |
|
- | 213 | } |
||
- | 214 | |
||
- | 215 | /*************************************************************************/ |
||
- | 216 | /* Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 */ |
||
- | 217 | /*************************************************************************/ |
||
- | 218 | function wasRGBToHex(r, g, b) { |
||
- | 219 | return "#" + ( |
||
- | 220 | (1 << 24) +><> |
||
- | 221 | |
||
- | 222 | |
||
- | 223 | |
||
- | 224 | |
||
- | 225 | |