We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b316f95 commit 1812ef8Copy full SHA for 1812ef8
src/styles.js
@@ -14,13 +14,15 @@ const opacity = (color, opacity) => {
14
// values.
15
let hex = color.replace('#', '')
16
hex = hex.length === 3 ? hex.replace(/./g, '$&$&') : hex
17
- const r = parseInt(hex.substring(0, 2), 16)
18
- const g = parseInt(hex.substring(2, 4), 16)
19
- const b = parseInt(hex.substring(4, 6), 16)
+
+ let r = parseInt(hex.substring(0, 2), 16)
+ let g = parseInt(hex.substring(2, 4), 16)
20
+ let b = parseInt(hex.substring(4, 6), 16)
21
22
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
23
return `color-mix(in oklab, ${color} ${opacity}, transparent)`
24
}
25
26
return `rgb(${r}, ${g}, ${b} / ${opacity})`
27
28
0 commit comments