Java Color Create generateColorFromString(String seed)

Here you can find the source of generateColorFromString(String seed)

Description

generate Color From String

License

Creative Commons License

Declaration

public static int generateColorFromString(String seed) 

Method Source Code

//package com.java2s;
/**/*w  w  w . ja  v  a 2  s.  c om*/
 * This class was created by <Vazkii>. It's distributed as
 * part of the ReCubed Mod.
 *
 * ReCubed is Open Source and distributed under a
 * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
 * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
 *
 * File Created @ [Dec 13, 2013, 4:18:48 PM (GMT)]
 */

import java.awt.Color;

import java.util.Random;

public class Main {
    public static int generateColorFromString(String seed) {
        Random rand = new Random(seed.hashCode());
        int red = rand.nextInt(256);
        int green = rand.nextInt(256);
        int blue = rand.nextInt(256);

        return new Color(red, green, blue).getRGB();
    }
}

Related

  1. colorFromString(String string)
  2. colorWithARGB(int alpha, int red, int green, int blue)
  3. colorWithIntAndAlpha(int color, int alpha)
  4. generateBlankImage(int w, int h, Color col)
  5. generateColor(int fc, int bc)
  6. generateColorModel()
  7. generateColorRamp(int n)
  8. generateColourSet(Color[] palette, int numColorBands)
  9. generateFireMapColor(double min, double max, double value)