Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Color; public class Main { public static int lighten(int color) { double r = Color.red(color); double g = Color.green(color); double b = Color.blue(color); r *= 1.1; g *= 1.1; b *= 1.1; double threshold = 255.999; double max = Math.max(r, Math.max(g, b)); if (max > threshold) { double total = r + g + b; if (total >= 3 * threshold) return Color.WHITE; double x = (3 * threshold - total) / (3 * max - total); double gray = threshold - x * max; r = gray + x * r; g = gray + x * g; b = gray + x * b; } return Color.argb(255, (int) r, (int) g, (int) b); } }