Java Color Create generateGrayScaleColor(double min, double max, double value)

Here you can find the source of generateGrayScaleColor(double min, double max, double value)

Description

generate Gray Scale Color

License

Open Source License

Declaration

public static Color generateGrayScaleColor(double min, double max, double value) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.*;

public class Main {
    public static Color generateGrayScaleColor(double min, double max, double value) {
        assert value >= min && value <= max;
        if (value < min || value > max) {
            throw new IllegalArgumentException("Value must be between min and max values, it was not.");
        }/*from w  w w.j a  va2s.c  o  m*/
        double power = (value - min) / (max - min); //will be between 0 and 1
        return Color.getHSBColor(0, 0, 1 - (float) power);
    }
}

Related

  1. generateColorFromString(String seed)
  2. generateColorModel()
  3. generateColorRamp(int n)
  4. generateColourSet(Color[] palette, int numColorBands)
  5. generateFireMapColor(double min, double max, double value)
  6. generateGreyColor(double value, double minValue, double maxValue)
  7. generateHexolor(Color color)
  8. generateNColors(int numColors)
  9. generateNextValidColor()