From 1a76bc15fe41339c0ae93b650b7e5eb634c9ce6d Mon Sep 17 00:00:00 2001 From: Kai Jauslin Date: Mon, 30 May 2022 10:22:42 +0200 Subject: [PATCH] fix: parse alpha value of hex format (#1251) --- src/utils/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index f6848a81e..76760058c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -260,8 +260,9 @@ export function parseColor(val: string): RGBAColor { g = parseInt(val.charAt(3) + val.charAt(4), 16); b = parseInt(val.charAt(5) + val.charAt(6), 16); } - - // TODO: parse hex with alpha? + if (val.length === 9) { + a = parseInt(val.charAt(7) + val.charAt(8), 16) / 255; + } } // Handling rgb notation