fix hex color padding

This commit is contained in:
dank074 2022-12-23 00:23:58 -06:00
parent b57ffc5426
commit 9693bcae0b

View File

@ -8,15 +8,7 @@ export class ColorUtils
public static makeColorNumberHex(color: number): string public static makeColorNumberHex(color: number): string
{ {
let val = color.toString(16); let val = color.toString(16);
if(val.length < 6) return ( '#' + val.padStart(6, '0'));
{
const diff = 6 - val.length;
for(let i = 0; i < diff; i++)
{
val = '0' + val;
}
}
return ( '#' + val);
} }
public static convertFromHex(color: string): number public static convertFromHex(color: string): number