Module: UWA/Color

UWA/Color

Color utilities

Index

Methods

<inner> toHexString() → {String}

Returning an hexadecimal color string

Returns
  • An hexadecimal string
Type
String

<inner> toRGBString() → {String}

Returning an rgba color string

Returns
  • An rgba string
Type
String

<inner> toHSLString() → {String}

Returning an hsla color string

Returns
  • An hsla string
Type
String

<inner> toObject() → {Object}

Returning an rgb, hsl and alpha object

Returns
  • An object containing rgba values:
                   - [Object.r]     {Int} - Red
                   - [Object.g]     {Int} - Green
                   - [Object.b]     {Int} - Blue
                   - [Object.h]     {Int} - Hue
                   - [Object.s]     {Int} - Saturation
                   - [Object.l]     {Int} - Lightness
                   - [Object.alpha] {Int} - Alpha
Type
Object

<inner> cloneWith(components) → {Color}

Returns a new Color replacing this color components with the ones passed as argument.

Example
// Get a new color by setting its "green" component
var newColor = color.cloneWith({ g: 255 });

// Get a new color by setting its "green" and "alpha" components
var newColor = color.cloneWith({ g: 255, alpha: 50 });
Parameters
Name Type Description
components Object

an object with optionaly any properties returned by the toObject method.

Returns

the resulting UWA/Color

Type
Color