UNPKG

831 BJavaScriptView Raw
1import { ColorBase } from './color-common';
2export class Color extends ColorBase {
3 get ios() {
4 if (!this._ios) {
5 // iOS Color is using floating-point values in the [0, 1] range, so divide the components by 255
6 this._ios = UIColor.alloc().initWithRedGreenBlueAlpha(this.r / 255, this.g / 255, this.b / 255, this.a / 255);
7 }
8 return this._ios;
9 }
10 static fromIosColor(value) {
11 const r = new interop.Reference();
12 const g = new interop.Reference();
13 const b = new interop.Reference();
14 const a = new interop.Reference();
15 value.getRedGreenBlueAlpha(r, g, b, a);
16 return new Color(Math.round(a.value * 255), Math.round(r.value * 255), Math.round(g.value * 255), Math.round(b.value * 255));
17 }
18}
19//# sourceMappingURL=index.ios.js.map
\No newline at end of file