mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-02-18 18:02:36 +01:00
fix hex color string padding
This commit is contained in:
parent
1c8c404d3e
commit
01a77db0fd
@ -7,7 +7,16 @@ export class ColorUtils
|
||||
|
||||
public static makeColorNumberHex(color: number): string
|
||||
{
|
||||
return ( '#' + color.toString(16));
|
||||
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);
|
||||
}
|
||||
|
||||
public static convertFromHex(color: string): number
|
||||
|
Loading…
x
Reference in New Issue
Block a user