Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Color; public class Main { public static int darken(int color, double fraction) { int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); red = darkenColor(red, fraction); green = darkenColor(green, fraction); blue = darkenColor(blue, fraction); int alpha = Color.alpha(color); return Color.argb(alpha, red, green, blue); } private static int darkenColor(int color, double fraction) { return (int) Math.max(color - (color * fraction), 0); } }