Color.darker

Syntax

darker(alpha: Number);

Parameters

alpha. Color transparency. The parameter may take values from 0 to 1.

Description

The darker method darkens color for the specified transparency value.

Comments

The method reduces color value, color transparency does not change.

Example

Executing the example requires that the HTML page contains the ColorCombo component named colCombo (see Example of Creating the ColorCombo Component). Darken the color selected in the drop-down list by 50%.

// Get color selected in the drop-down list
var color = colCombo.getColor();
// Display color parameter values in the console
console.log(color);
// Darken color
color = color.darker(0.5);
// Apply changed color
colCombo.setColor(color);
// Display color parameter values in the console
console.log(color);

After executing the example the color selected in the drop-down list is darkened by 50%:

The console displays color parameter values before and after darkening.

See. also:

Color