Color: case insensitive hex.
This commit is contained in:
parent
fb6f0fb69b
commit
e310126d00
@ -47,13 +47,13 @@ function hex2rgb(rgbString) {
|
|||||||
// Parse `dead00` and `f00`
|
// Parse `dead00` and `f00`
|
||||||
var channels = [];
|
var channels = [];
|
||||||
if (rgbString.length === 3) {
|
if (rgbString.length === 3) {
|
||||||
channels = rgbString.match(/([0-9a-f])/g);
|
channels = rgbString.match(/([0-9a-f])/ig);
|
||||||
channels = channels.map(function(hex) {
|
channels = channels.map(function(hex) {
|
||||||
return hex + hex;
|
return hex + hex;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
channels = rgbString.match(/([0-9a-f]){2}/g);
|
channels = rgbString.match(/([0-9a-f]){2}/ig);
|
||||||
}
|
}
|
||||||
if (channels.length !== 3) {
|
if (channels.length !== 3) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user