From 99ed1d362fa91332ce205a37a88f44efc09901b7 Mon Sep 17 00:00:00 2001 From: Robin van der Linde Date: Tue, 7 Jan 2025 23:24:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=20Fix=20broken=20color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/color.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/utils/color.ts b/src/utils/color.ts index cf6af2c..8475e04 100644 --- a/src/utils/color.ts +++ b/src/utils/color.ts @@ -90,24 +90,24 @@ export function mapCompleteToVScode(color: string): vscodeColor | undefined { switch (color.length) { case 4: return new vscodeColor( - parseInt(color[1] + color[1], 16) / 255, - parseInt(color[2] + color[2], 16) / 255, - parseInt(color[3] + color[3], 16) / 255, + parseInt(color.substring(1, 2), 16) / 255, + parseInt(color.substring(2, 3), 16) / 255, + parseInt(color.substring(3, 4), 16) / 255, 1 ); case 7: return new vscodeColor( - parseInt(color.substring(1, 2), 16) / 255, - parseInt(color.substring(3, 2), 16) / 255, - parseInt(color.substring(5, 2), 16) / 255, + parseInt(color.substring(1, 3), 16) / 255, + parseInt(color.substring(3, 5), 16) / 255, + parseInt(color.substring(5, 7), 16) / 255, 1 ); case 9: return new vscodeColor( - parseInt(color.substring(1, 2), 16) / 255, - parseInt(color.substring(3, 2), 16) / 255, - parseInt(color.substring(5, 2), 16) / 255, - parseInt(color.substring(7, 2), 16) / 255 + parseInt(color.substring(1, 3), 16) / 255, + parseInt(color.substring(3, 5), 16) / 255, + parseInt(color.substring(5, 7), 16) / 255, + parseInt(color.substring(7, 9), 16) / 255 ); default: return undefined;