lib-colors
Version:
Simple node.js library for work with colors
11 lines (7 loc) • 313 B
text/typescript
import { alphaIsSet } from '../../helpers/alpha_is_set.helper';
import type { ILAB } from '../lab.interface';
export function labToString(lab: ILAB): string {
const { l, a, b, alpha } = { ...lab };
const aValue = alphaIsSet(alpha) ? ` / ${alpha}` : '';
return `lab(${l} ${a} ${b}${aValue})`;
}