(hex)
| 8 | } |
| 9 | |
| 10 | function hexToRgb(hex) { |
| 11 | const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); |
| 12 | if (!m) throw new Error(`Bad hex color: ${hex}`); |
| 13 | return { |
| 14 | r: Number.parseInt(m[1], 16), |
| 15 | g: Number.parseInt(m[2], 16), |
| 16 | b: Number.parseInt(m[3], 16), |
| 17 | }; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Core: a tinted logo sized to `fraction` of the shorter side, centered on a |