Java Color Lighten lighter(Color clr, double saturationFraction)

Here you can find the source of lighter(Color clr, double saturationFraction)

Description

lighter

License

Open Source License

Declaration

public static Color lighter(Color clr, double saturationFraction) 

Method Source Code


//package com.java2s;
/*/*from w ww.  ja v  a  2 s  .  c  o m*/
 * Copyright (c) 2016 Vivid Solutions.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 *
 * http://www.eclipse.org/org/documents/edl-v10.php.
 */

import java.awt.Color;

public class Main {
    public static Color lighter(Color clr) {
        return lighter(clr, 0.4);
    }

    public static Color lighter(Color clr, double saturationFraction) {
        float[] hsb = new float[3];
        Color.RGBtoHSB(clr.getRed(), clr.getGreen(), clr.getBlue(), hsb);
        hsb[1] *= saturationFraction;
        return Color.getHSBColor(hsb[0], hsb[1], hsb[2]);
    }
}

Related

  1. lighter(Color c)
  2. lighter(Color c)
  3. lighter(Color c, boolean transparant)
  4. lighter(Color c, float factor)
  5. lighter(Color clr)
  6. lighter(Color color, double fraction)
  7. lighter(Color color, float ratio)
  8. lighter(final Color color, final int rgbOffset)
  9. lighter(final Color color, float factor)