Skip to content

Commit 5a5a020

Browse files
committed
fix(lineargradient): fix issue with rgba value as the first color stop
Fixes issue with rgba values having spaces and being used at the first color stop value. fix #538
1 parent cb3c0fc commit 5a5a020

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "polished",
3-
"version": "3.6.6",
3+
"version": "3.6.7",
44
"description": "A lightweight toolset for writing styles in Javascript.",
55
"license": "MIT",
66
"author": "Brian Hough <[email protected]> (https://polished.js.org)",

src/mixins/linearGradient.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ export default function linearGradient({
4343
throw new PolishedError(56)
4444
}
4545
return {
46-
backgroundColor: fallback || colorStops[0].split(' ')[0],
47-
backgroundImage: constructGradientValue`linear-gradient(${toDirection}${colorStops.join(
48-
', ',
49-
)})`,
46+
backgroundColor:
47+
fallback
48+
|| colorStops[0]
49+
.replace(/,\s+/g, ',')
50+
.split(' ')[0]
51+
.replace(/,(?=\S)/g, ', '),
52+
backgroundImage: constructGradientValue`linear-gradient(${toDirection}${colorStops
53+
.join(', ')
54+
.replace(/,(?=\S)/g, ', ')})`,
5055
}
5156
}

0 commit comments

Comments
 (0)