Here you can find the source of darker(Color c, double p)
public static Color darker(Color c, double p)
//package com.java2s; /*// w w w. j a v a2 s. c o m * Copyright 2005 MH-Software-Entwicklung. All rights reserved. * Use is subject to license terms. */ import java.awt.*; public class Main { public static Color darker(Color c, double p) { if (c == null) { return null; } double r = c.getRed(); double g = c.getGreen(); double b = c.getBlue(); r -= (r * p) / 100.0; g -= (g * p) / 100.0; b -= (b * p) / 100.0; return createColor((int) r, (int) g, (int) b); } public static final Color createColor(int r, int g, int b) { return new Color(((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF) << 0)); } }