colorConverter.format: use color.type by default

This commit is contained in:
tophf 2018-04-17 22:34:55 +03:00
parent 8cad7d61eb
commit 58f4fbec41

View File

@ -16,7 +16,8 @@ const colorConverter = (() => {
// NAMED_COLORS is added below // NAMED_COLORS is added below
}; };
function format(color, type, hexUppercase) { function format(color = '', type = color.type, hexUppercase) {
if (!color || !type) return '';
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') {