| 18 | } |
| 19 | |
| 20 | function alpha( |
| 21 | _designSystem: DesignSystem, |
| 22 | _source: AstNode, |
| 23 | value: string, |
| 24 | ...rest: string[] |
| 25 | ): string { |
| 26 | let [color, alpha] = segment(value, '/').map((v) => v.trim()) |
| 27 | |
| 28 | if (!color || !alpha) { |
| 29 | throw new Error( |
| 30 | `The --alpha(…) function requires a color and an alpha value, e.g.: \`--alpha(${color || 'var(--my-color)'} / ${alpha || '50%'})\``, |
| 31 | ) |
| 32 | } |
| 33 | |
| 34 | if (rest.length > 0) { |
| 35 | throw new Error( |
| 36 | `The --alpha(…) function only accepts one argument, e.g.: \`--alpha(${color || 'var(--my-color)'} / ${alpha || '50%'})\``, |
| 37 | ) |
| 38 | } |
| 39 | |
| 40 | return withAlpha(color, alpha) |
| 41 | } |
| 42 | |
| 43 | function spacing( |
| 44 | designSystem: DesignSystem, |