Java examples for 2D Graphics:Color Light
brighter color by value
//package com.java2s; import java.awt.Color; public class Main { public static Color brighter(Color c, int value) { if (value < 0) return c; float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), new float[3]); int h = (int) (hsb[0] * 360); int s = (int) (hsb[1] * 100); int b = (int) (hsb[2] * 100); int rm = 0; b += value;/*w w w . j a va 2s . c o m*/ if (b > 100) { rm = b - 100; b = 100; } s -= rm; if (s < 0) s = 0; int rgb = Color.HSBtoRGB(h / 360.0f, s / 100.0f, b / 100.0f); return new Color(rgb); } }