Here you can find the source of lighten(final Color color, final int amount)
Parameter | Description |
---|---|
color | Color to lighten. |
amount | Amont to lighten the color of. |
private static Color lighten(final Color color, final int amount)
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { /**/*from www . j a v a2 s. c om*/ * Lightens of the desired amount the given color. * @param color * Color to lighten. * @param amount * Amont to lighten the color of. * @return The lightened color. */ private static Color lighten(final Color color, final int amount) { int red = (color.getRed() + amount > 255) ? 255 : color.getRed() + amount; int green = (color.getGreen() + amount > 255) ? 255 : color.getGreen() + amount; int blue = (color.getBlue() + amount > 255) ? 255 : color.getBlue() + amount; Color colorLightened = new Color(red, green, blue); return colorLightened; } }