ColorPicker: fix hex format color valid error (#22596)

pull/22600/head
erlangera 2023-07-12 00:00:41 +08:00
parent f14b5ba540
commit 0c01f6c22e
1 changed files with 1 additions and 1 deletions

View File

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