Color

Using Colors requires the "color" module.

import * as colorModule from "tns-core-modules/color";
var Color = colorModule.Color;

Creating a Color from a hex value.

// Creates the red color
var color = new Color("#FF0000");

Creating a Color from a short hex value.

// Creates the color #FF8800
var color = new Color("#F80");

Creating a Color from four ARGB values

// Creates the color with 100 alpha, 255 red, 100 green, 100 blue
var color = new Color(100, 255, 100, 100);

Creating a Color from a single ARGB value

// Creates the color with 100 alpha, 100 red, 100 green, 100 blue
var color = new Color(0x64646464);

Stay connected with NativeScript

(expect a newsletter every 4-8 weeks)

NativeScript
NativeScript is licensed under the Apache 2.0 license .
© Progress Software Corporation. All Rights Reserved.