From 9693bcae0b73f032262a451aa9c4176cfbe35c35 Mon Sep 17 00:00:00 2001 From: dank074 Date: Fri, 23 Dec 2022 00:23:58 -0600 Subject: [PATCH] fix hex color padding --- src/api/utils/ColorUtils.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/api/utils/ColorUtils.ts b/src/api/utils/ColorUtils.ts index a22c90a4..e31643b6 100644 --- a/src/api/utils/ColorUtils.ts +++ b/src/api/utils/ColorUtils.ts @@ -8,15 +8,7 @@ export class ColorUtils public static makeColorNumberHex(color: number): string { let val = color.toString(16); - if(val.length < 6) - { - const diff = 6 - val.length; - for(let i = 0; i < diff; i++) - { - val = '0' + val; - } - } - return ( '#' + val); + return ( '#' + val.padStart(6, '0')); } public static convertFromHex(color: string): number