(color, coefficient)
| 44 | function attachColorManipulators(theme) { |
| 45 | Object.assign(theme, { |
| 46 | alpha(color, coefficient) { |
| 47 | const obj = this || theme; |
| 48 | if (obj.colorSpace) { |
| 49 | return `oklch(from ${color} l c h / ${typeof coefficient === 'string' ? `calc(${coefficient})` : coefficient})`; |
| 50 | } |
| 51 | if (obj.vars) { |
| 52 | // To preserve the behavior of the CSS theme variables |
| 53 | // In the future, this could be replaced by `color-mix` (when https://caniuse.com/?search=color-mix reaches 95%). |
| 54 | return `rgba(${color.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g, 'var(--$1Channel)')} / ${typeof coefficient === 'string' ? `calc(${coefficient})` : coefficient})`; |
| 55 | } |
| 56 | return systemAlpha(color, parseAddition(coefficient)); |
| 57 | }, |
| 58 | lighten(color, coefficient) { |
| 59 | const obj = this || theme; |
| 60 | if (obj.colorSpace) { |
no test coverage detected
searching dependent graphs…