mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 07:30:51 +01:00
fix hex color padding
This commit is contained in:
parent
b57ffc5426
commit
9693bcae0b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user