colorConverter.format: passthru if string and no type given

fixes #408
fixes f7f679bb
This commit is contained in:
tophf 2018-06-30 10:39:24 +03:00
parent 361feb90d4
commit b49254aca2

View File

@ -17,7 +17,7 @@ const colorConverter = (() => {
}; };
function format(color = '', type = color.type, hexUppercase) { function format(color = '', type = color.type, hexUppercase) {
if (!color || !type) return ''; if (!color || !type) return typeof color === 'string' ? color : '';
const a = formatAlpha(color.a); const a = formatAlpha(color.a);
const hasA = Boolean(a); const hasA = Boolean(a);
if (type === 'rgb' && color.type === 'hsl') { if (type === 'rgb' && color.type === 'hsl') {