Revert indent
This commit is contained in:
parent
6beed6b9c9
commit
fe337702bd
|
@ -98,15 +98,16 @@ const colorConverter = (() => {
|
||||||
str = colorConverter.NAMED_COLORS.get(str);
|
str = colorConverter.NAMED_COLORS.get(str);
|
||||||
if (!str) return;
|
if (!str) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str[0] === '#') {
|
if (str[0] === '#') {
|
||||||
if (validateHex(str)) {
|
if (!validateHex(str)) {
|
||||||
str = str.slice(1);
|
return null;
|
||||||
const [r, g, b, a = 255] = str.length <= 4 ?
|
|
||||||
str.match(/(.)/g).map(c => parseInt(c + c, 16)) :
|
|
||||||
str.match(/(..)/g).map(c => parseInt(c, 16));
|
|
||||||
return {type: 'hex', r, g, b, a: a === 255 ? undefined : a / 255};
|
|
||||||
}
|
}
|
||||||
return null;
|
str = str.slice(1);
|
||||||
|
const [r, g, b, a = 255] = str.length <= 4 ?
|
||||||
|
str.match(/(.)/g).map(c => parseInt(c + c, 16)) :
|
||||||
|
str.match(/(..)/g).map(c => parseInt(c, 16));
|
||||||
|
return {type: 'hex', r, g, b, a: a === 255 ? undefined : a / 255};
|
||||||
}
|
}
|
||||||
|
|
||||||
const [, type, value] = str.match(/^(rgb|hsl)a?\((.*?)\)|$/i);
|
const [, type, value] = str.match(/^(rgb|hsl)a?\((.*?)\)|$/i);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user