($rgb: string)
| 364 | } |
| 365 | |
| 366 | function parseRGB($rgb: string): RGBA | null { |
| 367 | const [r, g, b, a = 1] = getNumbersFromString($rgb, rgbRange, rgbUnits); |
| 368 | if (r == null || g == null || b == null || a == null) { |
| 369 | return null; |
| 370 | } |
| 371 | return {r, g, b, a}; |
| 372 | } |
| 373 | |
| 374 | const hslRange = [360, 1, 1, 1]; |
| 375 | const hslUnits = {'%': 100, 'deg': 360, 'rad': 2 * Math.PI, 'turn': 1}; |
no test coverage detected