Class ColorAbstract

Since

0.1 Color is used to color UI objects and its elements. A Color instance is created by passing RGB-ARGB values or hexadecimal string. There are constant and predefined colors as well.

Example

import Color from '@smartface/native/ui/color';
const myRedColor = Color.create(255, 0, 0);
const myBlueColorWithAlpha = Color.create(100, 0, 0, 255);
const myHEXColor = Color.create("#FFAACC");

Hierarchy

  • default
    • Color

Implements

Properties

_nativeObject: any
isGradient?: boolean

Get/sets the direction of the gradient image.

BLACK: IColor

Android

Ios

Since

0.1

BLUE: IColor

Android

Ios

Since

0.1

CYAN: IColor

Android

Ios

Since

0.1

DARKGRAY: IColor

Android

Ios

Since

0.1

GRAY: IColor

Android

Ios

Since

0.1

GREEN: IColor

Android

Ios

Since

0.1

LIGHTGRAY: IColor

Android

Ios

Since

0.1

MAGENTA: IColor

Android

Ios

Since

0.1

RED: IColor

Android

Ios

Since

0.1

TRANSPARENT: IColor

Android

Ios

Since

0.1

YELLOW: IColor

Android

Ios

Since

0.1

WHITE: IColor

Android

Ios

Since

0.1

GradientDirection: typeof GradientDirection

Accessors

  • get nativeObject(): any
  • Returns any

  • set nativeObject(value: any): void
  • Parameters

    • value: any

    Returns void

Methods

  • Executed before constuctor and after createNativeObject. Use this when you have default values which needs to be set before constructor.

    Parameters

    • Optional params: Partial<Record<string, any>>

    Returns void

  • Gets the red value of the color

    Returns number

  • Gets the green value of the color

    Returns number

  • Gets the blue value of the color

    Returns number

  • Gets the alpha value of the color

    Returns number

  • Executed before everything. This should return nativeObject since it will be assinged directly to nativeObject.

    Parameters

    • params: any

    Returns void

  • Creates a new color with RGB-ARGB or hexadecimal parameters

    Example

    import Color from '@smartface/native/ui/color';
    const myRedColor = Color.create(255, 0, 0);
    const myBlueColorWithAlpha = Color.create(100, 0, 0, 255);
    const myHEXColor = Color.create("#FFAACC");

    Android

    Ios

    Since

    0.1

    Parameters

    • alpha: number
    • red: number
    • green: number
    • blue: number

    Returns IColor

  • Creates a new color with RGB-ARGB or hexadecimal parameters

    Example

    import Color from '@smartface/native/ui/color';
    const myRedColor = Color.create(255, 0, 0);
    const myBlueColorWithAlpha = Color.create(100, 0, 0, 255);
    const myHEXColor = Color.create("#FFAACC");

    Android

    Ios

    Since

    0.1

    Parameters

    • red: number
    • green: number
    • blue: number

    Returns IColor

  • Creates a new color with RGB-ARGB or hexadecimal parameters

    Example

    import Color from '@smartface/native/ui/color';
    const myRedColor = Color.create(255, 0, 0);
    const myBlueColorWithAlpha = Color.create(100, 0, 0, 255);
    const myHEXColor = Color.create("#FFAACC");

    Android

    Ios

    Since

    0.1

    Parameters

    • color: string

    Returns IColor

  • Returns the red value of a color instance.

    Example

    import Color from '@smartface/native/ui/color';

    const myRGBColor = Color.create(99, 0, 0);
    const red = Color.red(myRGBColor);
    console.log("" + red);

    Android

    Ios

    Since

    0.1

    Parameters

    Returns number

  • Returns the green value of a color instance.

    Example

    import Color from '@smartface/native/ui/color';

    const myRGBColor = Color.create(0, 171, 0);
    const green = Color.green(myRGBColor);
    console.log("" + green);

    Android

    Ios

    Since

    0.1

    Parameters

    Returns number

  • Returns the blue value of a color instance.

    Example

    import Color from '@smartface/native/ui/color';

    const myRGBColor = Color.create(0, 0, 155);
    const blue = Color.blue(myRGBColor);
    console.log("" + blue);

    Android

    Ios

    Since

    0.1

    Parameters

    Returns number

  • Returns the alpha value of a color instance.

    Example

    import Color from '@smartface/native/ui/color';

    var myARGBColor = Color.create(42, 0, 0, 255);
    var alpha = Color.alpha(myARGBColor);
    console.log(alpha);

    Android

    Ios

    Since

    0.1

    Parameters

    Returns number

Constructors

  • Parameters

    • Optional params: ConstructorParams

    Returns Color

Generated using TypeDoc