JXtension - Color.getDarker(percentage)

Purpose:
Give the user the ability to get a darker version of a color.

Parameters:

[ percentage ] The amount of black you would like to combine with the color.  Valid values range from 0 to 100.  This parameter is optional.  If omitted, the default percentage is 30.

Returns:
Returns a new color, a specified percentage closer to black.

Example #1:
The following code will create a random color in the left cell below the code.  After that, it will create a darker version of that color in the cell to the right of it:

 

Example #2:
The following example will mimic the above example but will use 50 as the percentage:

 

See also: