You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/core/color.md
+23-12
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,27 @@ description: Create a color object with any color representation and use it in y
4
4
---
5
5
6
6
The `Color` class enables the creation of a color object:
7
-
- using color components (alpha, red, green, blue) ranging from 0 to 255,
8
-
- using various color representations like ARGB, color names, hex values, and more.
9
-
7
+
8
+
- using color components (alpha, red, green, blue) ranging from 0 to 255,
9
+
- using various color representations like ARGB, color names, hex values, and more.
10
+
10
11
The `ios` and `android` properties of the `Color` class instance return the native platform instance of [UIColor](https://developer.apple.com/documentation/uikit/uicolor) on iOS and [Color](https://developer.android.com/reference/android/graphics/Color) on Android.
@@ -36,25 +38,31 @@ Creates a color object. The Color class offers the following constructor overloa
36
38
```ts
37
39
const color =newColor(knownColor)
38
40
```
41
+
39
42
Creates a Color instance from a known color name.
43
+
40
44
-`knownColor` : A color name string such as `'red'`, `'purple'`, `'orange'`.
41
45
42
46
```ts
43
47
const color =newColor(hex)
44
48
```
49
+
45
50
Creates a Color instance from a color hexidecimal code.
46
51
47
52
-`hex`: A string of a hexidecimal color value such as `'#fff'` or `'#FF00CC'`.
48
53
49
54
```ts
50
55
const color =newColor(argb)
51
56
```
57
+
52
58
Creates a Color instance from a number representing a color with an alpha.
53
-
-`argb`: A number such as `4293377432` as, representing color.
59
+
60
+
-`argb`: A number such as `4293377432` as, representing color.
54
61
55
62
```ts
56
63
const color =newColor(alpha: number, red: number, green:number, blue: number, type?:'rgb'|'hsl'|'hsv')
57
64
```
65
+
58
66
---
59
67
60
68
### a
@@ -100,7 +108,7 @@ Gets the Blue component of the color. This is a `read-only` property.
100
108
### argb
101
109
102
110
```ts
103
-
colorARGB: number=color.argb
111
+
colorARGB: number=color.argb
104
112
```
105
113
106
114
Gets the Argb Number representation of this color where each 8 bits represent a single color component. This is a `read-only` property.
@@ -120,7 +128,7 @@ Gets the Hexadecimal string representation of the color.
120
128
### name
121
129
122
130
```ts
123
-
colorName: string=color.name
131
+
colorName: string=color.name
124
132
```
125
133
126
134
Gets the known name of this instance. Defined only if it has been constructed from a known color name - e.g. "red".
@@ -157,7 +165,7 @@ A static Color class method that compares two `Color` instances and returns `tru
157
165
158
166
---
159
167
160
-
### Color.isValid()
168
+
### Color.isValid()
161
169
162
170
```ts
163
171
isValidColorValue: boolean=Color.isValid(value)
@@ -213,7 +221,7 @@ A static method that returns a new Color from HSV.
213
221
color.equals(value)
214
222
```
215
223
216
-
A Color instance method that checks whether the color instance on which the method is called equals the Color instance passed to the method.
224
+
A Color instance method that checks whether the color instance on which the method is called equals the Color instance passed to the method.
217
225
218
226
---
219
227
@@ -262,9 +270,10 @@ Returns the color's [luminance](http://www.w3.org/TR/2008/REC-WCAG20-20081211/#r
262
270
```ts
263
271
colorWithAlpha: Color=color.setAlpha(a)
264
272
```
273
+
265
274
Adds the specified alpha to the color instance on which the method is called and returns the result as a new Color instance.
266
275
267
-
`a` is a value between `0` and `255`.
276
+
`a` is a value between `0` and `255`.
268
277
269
278
---
270
279
@@ -377,6 +386,7 @@ colorSpinned: Color = color.spin(amount)
377
386
Spins the hue by the given amount, from -`360` to `360`. Calling with `0`, `360`, or -`360` does nothing since it sets the hue back to what it was before.
378
387
379
388
---
389
+
380
390
### complement()
381
391
382
392
```ts
@@ -388,5 +398,6 @@ Returns a Color instance that is the complement of the current color.
Copy file name to clipboardExpand all lines: content/guide/adding-native-code.md
+2-4
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,12 @@
2
2
title: Adding custom native code to a project
3
3
---
4
4
5
-
6
-
NativeScript allows you to access any native APIs anytime in your app. If the native API you need is not exposed through [@nativescript/core](https://docs.nativescript.org/understanding-packages#nativescript-core) or [third party plugins](https://market.nativescript.org/) or [@nativescript/* plugins](https://docs.nativescript.org/plugins/index.html)), you can add it to your project and access it right away in TypeScript.
7
-
5
+
NativeScript allows you to access any native APIs anytime in your app. If the native API you need is not exposed through [@nativescript/core](https://docs.nativescript.org/understanding-packages#nativescript-core) or [third party plugins](https://market.nativescript.org/) or [@nativescript/\* plugins](https://docs.nativescript.org/plugins/index.html)), you can add it to your project and access it right away in TypeScript.
8
6
9
7
1. Add native code to [App_Resources](/project-structure/app-resources). For example, see [Adding Java/Kotlin code to an application](/project-structure/app-resources#adding-java-kotlin-code-to-an-application) and [Adding ObjectiveC/Swift Code to an application](/project-structure/app-resources#adding-objectivec-swift-code-to-an-application)
0 commit comments