Fix hex parsing

merge-requests/12/head
Bsian 2020-04-21 18:53:12 +01:00
parent b0aadbc73e
commit 4f55e29094
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 2 additions and 6 deletions

View File

@ -119,11 +119,7 @@ export default class Util {
} }
public decimalToHex(int: number): string { public decimalToHex(int: number): string {
const red = (int && 0x0000ff) << 16; const hex = int.toString(16);
const green = int && 0x00ff00; return '#000000'.substring(0, 7 - hex.length) + hex;
const blue = (int && 0xff0000) >>> 16;
const number = red | green | blue;
const asHex = number.toString(16);
return '#000000'.substring(0, 7 - asHex.length) + asHex;
} }
} }