Revert indent
This commit is contained in:
parent
6beed6b9c9
commit
fe337702bd
|
@ -98,16 +98,17 @@ const colorConverter = (() => {
|
|||
str = colorConverter.NAMED_COLORS.get(str);
|
||||
if (!str) return;
|
||||
}
|
||||
|
||||
if (str[0] === '#') {
|
||||
if (validateHex(str)) {
|
||||
if (!validateHex(str)) {
|
||||
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};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const [, type, value] = str.match(/^(rgb|hsl)a?\((.*?)\)|$/i);
|
||||
if (!type) return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user