Here you can find the source of getSlightlyBrighter(Color color)
Parameter | Description |
---|---|
color | the color used as basis for the brightened color |
public static Color getSlightlyBrighter(Color color)
//package com.java2s; import java.awt.*; public class Main { /**// w w w. ja v a2s . com * Computes and returns a Color that is slightly brighter * than the specified Color. * * @param color the color used as basis for the brightened color * @return a slightly brighter color */ public static Color getSlightlyBrighter(Color color) { return getSlightlyBrighter(color, 1.1f); } /** * Computes and returns a Color that is slightly brighter * than the specified Color. * * @param color the color used as basis for the brightened color * @param factor the factor used to compute the brightness * @return a slightly brighter color */ public static Color getSlightlyBrighter(Color color, float factor) { float[] hsbValues = new float[3]; Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsbValues); float hue = hsbValues[0]; float saturation = hsbValues[1]; float brightness = hsbValues[2]; float newBrightness = Math.min(brightness * factor, 1.0f); return Color.getHSBColor(hue, saturation, newBrightness); } }