Skip to content

Commit f7b1983

Browse files
committed
Add variable fallback to fix Chrome issue
1 parent 4de0769 commit f7b1983

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/util/removeAlphaVariables.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export function removeAlphaVariables(container, toRemove) {
1818
for (let varName of toRemove) {
1919
if (decl.value.includes(`/ var(${varName})`)) {
2020
decl.value = decl.value.replace(`/ var(${varName})`, '')
21+
} else if (decl.value.includes(`/ var(${varName}, 1)`)) {
22+
decl.value = decl.value.replace(`/ var(${varName}, 1)`, '')
2123
}
2224
}
2325
})

src/util/withAlphaVariable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function withAlphaVariable({ color, property, variable }) {
2121
[variable]: '1',
2222
...Object.fromEntries(
2323
properties.map((p) => {
24-
return [p, color({ opacityVariable: variable, opacityValue: `var(${variable})` })]
24+
return [p, color({ opacityVariable: variable, opacityValue: `var(${variable}, 1)` })]
2525
})
2626
),
2727
}
@@ -42,7 +42,7 @@ export default function withAlphaVariable({ color, property, variable }) {
4242
[variable]: '1',
4343
...Object.fromEntries(
4444
properties.map((p) => {
45-
return [p, formatColor({ ...parsed, alpha: `var(${variable})` })]
45+
return [p, formatColor({ ...parsed, alpha: `var(${variable}, 1)` })]
4646
})
4747
),
4848
}

0 commit comments

Comments
 (0)