From 401c4064df4c522bc25d334664121d400d6549f3 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Mon, 9 Sep 2019 19:50:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dhex=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E5=80=BC=E4=B8=BA3=E4=BD=8D=E6=97=B6=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/color.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shared/color.js b/src/shared/color.js index e0198241b..8519e3e12 100644 --- a/src/shared/color.js +++ b/src/shared/color.js @@ -7,8 +7,12 @@ export function hexToRgba (hex) { r = hex.substring(0, 2) g = hex.substring(2, 4) b = hex.substring(4, 6) - } else { - return false + } else if (hex.length === 3) { + r = hex.substring(0, 1) + g = hex.substring(1, 2) + b = hex.substring(2, 3) + } else { + return false } if (r.length === 1) { r += r -- GitLab