Skip to content

Commit dfd0dd0

Browse files
Merge pull request #399 from WarrenMoore/dev
allow Colors to take ARGB values
2 parents 9744957 + d2000ce commit dfd0dd0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Colors/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const normalizeColorToARGB = color => {
7979
if (!targetColor) {
8080
targetColor = color
8181
}
82-
const check = /^#([0-9A-F]{3}|[0-9A-F]{6})$/i
82+
const check = /^#([0-9A-F]{3}|[0-9A-F]{6}|[0-9A-F]{8})$/i
8383
if (isString(targetColor) && check.test(targetColor)) {
8484
let hex = check.exec(targetColor)[1]
8585
if (hex.length === 3) {
@@ -90,7 +90,7 @@ const normalizeColorToARGB = color => {
9090
})
9191
.join('')
9292
}
93-
targetColor = `0xff${hex}` * 1
93+
targetColor = (hex.length === 8 ? `0x${hex}` : `0xff${hex}`) * 1
9494
}
9595
if (!normalizedColors[color]) {
9696
normalizedColors[color] = targetColor

0 commit comments

Comments
 (0)