Java tutorial
//package com.java2s; //License from project: Open Source License import java.awt.Color; public class Main { /** * @param color * @param factor * @return a new color, darker than the one passed as argument by a percentage factor * * <br>author Cyril Gambis - [Mar 17, 2005] */ public static Color darker(Color color, double factor) { return new Color(Math.max((int) (color.getRed() * factor), 0), Math.max((int) (color.getGreen() * factor), 0), Math.max((int) (color.getBlue() * factor), 0)); } }