Java Color Create generateNextValidColor()

Here you can find the source of generateNextValidColor()

Description

generate Next Valid Color

License

Open Source License

Declaration

public static int generateNextValidColor() 

Method Source Code


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

import java.awt.Color;

public class Main {
    private static int redValue = 0;
    private static int greenValue = 0;
    private static int blueValue = 0;
    private static int alphaValue = 255;

    public static int generateNextValidColor() {
        int step = 1;
        redValue += step;/*from w  w  w .ja va  2 s  .  c o m*/
        if (redValue == 256) {
            greenValue += step;
            redValue = 0;
            if (greenValue == 256) {
                blueValue += step;
                greenValue = 0;
                if (blueValue == 256) {
                    System.out.println("We have reached the limit of the number of objects!! 255*255*255!!!");
                }
            }

        }
        Color c = new Color(redValue, greenValue, blueValue, alphaValue);
        return (c.getRGB());

    }
}

Related

  1. generateFireMapColor(double min, double max, double value)
  2. generateGrayScaleColor(double min, double max, double value)
  3. generateGreyColor(double value, double minValue, double maxValue)
  4. generateHexolor(Color color)
  5. generateNColors(int numColors)
  6. generatePallete(final int colours)
  7. generateRGBRandomColor()
  8. generateTexturePaint(String text, Font font, Color textColor, Color bgColor, int width, int height)
  9. generateVisuallyDistinctColors(int ncolors, float minComponent, float maxComponent)