fix(color-picker): fix color-picker can't select 8-digit hex color (#1323)

This commit is contained in:
kooriookami
2021-01-20 20:30:40 -06:00
committed by GitHub
parent bdc0f6693c
commit df6918f51c

View File

@@ -255,7 +255,7 @@ export default class Color {
}
} else if (value.indexOf('#') !== -1) {
const hex = value.replace('#', '').trim()
if (!/^(?:[0-9a-fA-F]{3}){1,2}$/.test(hex)) return
if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex)) return
let r, g, b
if (hex.length === 3) {