fix: finally Color.hex should be good

This commit is contained in:
Martin Guillon
2021-07-06 14:55:30 +02:00
parent 7e0ecaa6cd
commit 276b130ed8

View File

@@ -69,12 +69,11 @@ export class Color implements definition.Color {
}
get hex(): string {
if (this.a === 0xff) {
return SHARP + ((1 << 24) + (this.r << 16) + (this.g << 8) + this.b).toString(16).slice(1);
} else {
const hex = this._argb.toString(16);
return SHARP + hex.slice(2) + hex.slice(0, 2);
let result = SHARP + ('000000' + (this._argb & 0xFFFFFF).toString(16)).slice(-6);
if (this.a !== 0xff) {
return result += ('00' + (this.a).toString(16)).slice(-2);
}
return result;
}
get name(): string {