| 565 | }; |
| 566 | |
| 567 | const rgba01ToCssRgba = (rgba: readonly [number, number, number, number]): string => { |
| 568 | const r = Math.max(0, Math.min(255, Math.round(rgba[0] * 255))); |
| 569 | const g = Math.max(0, Math.min(255, Math.round(rgba[1] * 255))); |
| 570 | const b = Math.max(0, Math.min(255, Math.round(rgba[2] * 255))); |
| 571 | const a = Math.max(0, Math.min(1, rgba[3])); |
| 572 | return `rgba(${r},${g},${b},${a})`; |
| 573 | }; |
| 574 | |
| 575 | const withAlpha = (cssColor: string, alphaMultiplier: number): string => { |
| 576 | const parsed = parseCssColorToRgba01(cssColor); |