Color.toString

Syntax

toString(includeAlpha)

Parameters

includeAlpha. Indicates if the opacity value is displayed.

Description

The toString method returns the string with the string with the color value in the hexadecimal format with the grid value in the beginning.

Comments

If this parameter is set to True, the string looks like #FFFFFFFF, and the components are shown in the following order: A, R, G, B.

If this parameter is set to False (default), the string looks like #FFFFFF. The components (A excluded) are shown in the same order.

Example

To execute the example the HTML page must contain the ColorCombo component named colCombo (see Example of Creating the ColorCombo Component). Add a handler for the ColorCombo.ColorChanged:

colCombo.ColorChanged.add(function (sender, args) {        
    var col = colCombo.getColor();        
    console.log(col.toString(true), +" / " +
        col.toDecimalString(false))    
});

After executing the example on changing color in the ColorCombo component the JavaScript browser console displays strings with color values in different formats, for example, for the current red color it displays: "#FFFF0000 / rgb(255, 0, 0)".

See also:

Color