Java Color Darker darker(Color c)

Here you can find the source of darker(Color c)

Description

This is a weaker version of Color#brighter() Uses a factor closer to 1.

License

Open Source License

Return

darker Color

Declaration

public static Color darker(Color c) 

Method Source Code


//package com.java2s;
import java.awt.Color;

public class Main {
    /**/*from  w  w w.  jav a 2 s. c o  m*/
     * This is a weaker version of {@link Color#brighter()}
     * Uses a factor closer to 1.
     * @see Color#darker()
     * @return darker Color
     */
    public static Color darker(Color c) {
        float[] hsb = new float[3];
        int r = c.getRed();
        int g = c.getGreen();
        int b = c.getBlue();
        Color.RGBtoHSB(r, g, b, hsb);
        //System.out.println("Saturation: " + hsb[1] + "   ->   " + (hsb[1] * 0.95f));
        //System.out.println("Brightness: " + hsb[2] + "   ->   " + (hsb[2] * 0.95f));
        return Color.getHSBColor(hsb[0], hsb[1] * 0.7f, hsb[2] * 0.95f);
    }
}

Related

  1. darken(Color col)
  2. darken(final Color color, final double percentage)
  3. darken(final Color color, final int amount)
  4. darkenColor(Color color)
  5. darker(Color c)
  6. darker(Color c, double factor)
  7. darker(Color c, double p)
  8. darker(Color c, double p)
  9. darker(Color c, float factor)