mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix: finally Color.hex should be good
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user