(hex)
| 19 | const HEX_CHAR_DOUBLE_RE = /./g |
| 20 | |
| 21 | function hexToRgb(hex) { |
| 22 | hex = hex.replace('#', '') |
| 23 | hex = hex.length === 3 ? hex.replaceAll(HEX_CHAR_DOUBLE_RE, '$&$&') : hex |
| 24 | const r = Number.parseInt(hex.slice(0, 2), 16) |
| 25 | const g = Number.parseInt(hex.slice(2, 4), 16) |
| 26 | const b = Number.parseInt(hex.slice(4, 6), 16) |
| 27 | return `${r} ${g} ${b}` |
| 28 | } |
| 29 | |
| 30 | const defaultModifiers = { |
| 31 | 'sm': { |