pass computeColor into shadow control, fix shadow switching types due to invalid shadow color

This commit is contained in:
Henry Jameson 2024-10-12 01:26:29 +03:00
commit 098c6af7ef
7 changed files with 19 additions and 7 deletions

View file

@ -21,7 +21,11 @@ export const parseShadow = string => {
const regex = new RegExp(regexPrep, 'gis') // global, (stable) indices, single-string
const result = regex.exec(string)
if (result == null) {
return string
if (string.startsWith('$') || string.startsWith('--')) {
return string
} else {
throw new Error(`Invalid shadow definition: ${string}`)
}
} else {
const numeric = new Set(['x', 'y', 'blur', 'spread', 'alpha'])
const { x, y, blur, spread, alpha, inset, color } = Object.fromEntries(modes.map((mode, i) => {