(hsl: HSLA)
| 140 | } |
| 141 | |
| 142 | export function hslToString(hsl: HSLA): string { |
| 143 | const {h, s, l, a} = hsl; |
| 144 | if (a != null && a < 1) { |
| 145 | return `hsla(${toFixed(h)}, ${toFixed(s * 100)}%, ${toFixed(l * 100)}%, ${toFixed(a, 2)})`; |
| 146 | } |
| 147 | return `hsl(${toFixed(h)}, ${toFixed(s * 100)}%, ${toFixed(l * 100)}%)`; |
| 148 | } |
| 149 | |
| 150 | const rgbMatch = /^rgba?\([^\(\)]+\)$/; |
| 151 | const hslMatch = /^hsla?\([^\(\)]+\)$/; |
no test coverage detected