mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 15:40: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
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user