Here you can find the source of darkerColor(Color color, double factor)
Color
that is a darker version of this Color
.
Color
object that is a darker version of this Color
.
public static Color darkerColor(Color color, double factor)
//package com.java2s; /*/* ww w .j a v a2 s . c o m*/ * PHEX - The pure-java Gnutella-servent. * Copyright (C) 2001 - 2005 Phex Development Group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * --- CVS Information --- * $Id: GUIUtils.java,v 1.33 2005/10/08 17:21:56 gregork Exp $ */ import java.awt.*; public class Main { /** * Creates a new <code>Color</code> that is a darker version of this * <code>Color</code>. This method is the same implementation * java.awt.Color#darker is usind except it has a configurable factor. * The java.awt.Color default facotr is 0.7 * @return a new <code>Color</code> object that is * a darker version of this <code>Color</code>. * @see java.awt.Color#brighter */ public static Color darkerColor(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)); } }