@PublicAPI public final class ColorGenerator extends java.lang.Object
List
of Color
s which are distinguishable from each other and some
specified other colors (typically from background colors). The order of the generated
Color
s is the same on the same collection of forbidden colors, regardless of the number
of the required colors. This class also provides a few collections of colors, for gathering the
most used forbidden colors.Color
s without the most often used molecule label colors and
without the base (red, green, blue, cyan magenta, yellow, black, white) colors, and you intend to
use them on a light background:List<Color> colors =
ColorGenerator.generateColors(n, gatherBaseColorsAndBaseMoleculeColors(true));
List<Color> colors = ColorGenerator.generateColors(n);
Color
,
Collection
,
List
,
gatherBlackAndWhite()
,
gatherBaseColors()
,
gatherBaseMoleculeColors(boolean)
,
gatherBaseColorsAndBaseMoleculeColors(boolean)
Constructor and Description |
---|
ColorGenerator() |
Modifier and Type | Method and Description |
---|---|
static java.util.Collection<java.awt.Color> |
gatherBaseColors()
Creates a
Collection of the base colors.These colors are: - black - white - red - green - blue - cyan - magenta - yellow. |
static java.util.Collection<java.awt.Color> |
gatherBaseColorsAndBaseMoleculeColors(boolean onLightBackground)
Creates a
Collection of the base Molecule RGB colors and base colors.These colors are the atom label RGB colors of: - H - C - N - O - S - F - P - Cl - Br - I. |
static java.util.Collection<java.awt.Color> |
gatherBaseMoleculeColors(boolean onLightBackground)
Creates a
Collection of the base Molecule RGB colors.These colors are the atom label RGB colors of: - H - C - N - O - S - F - P - Cl - Br - I. and - black - white |
static java.util.Collection<java.awt.Color> |
gatherBlackAndWhite()
Creates a
Collection of black and white color |
static java.util.List<java.awt.Color> |
generateColors(int count)
Generates the specified number of different
Color s, with no forbidden colors. |
static java.util.List<java.awt.Color> |
generateColors(int count,
java.util.Collection<java.awt.Color> forbiddenColors)
Generates the specified number of different
Color s, which are different enough from
the specified forbidden colors. |
public static final java.util.List<java.awt.Color> generateColors(int count, java.util.Collection<java.awt.Color> forbiddenColors)
Color
s, which are different enough from
the specified forbidden colors. If there are too many forbidden and required colors (greater
than 224), this function throws IllegalArgumentException
.count
- the number of the required colors between 1 and 224forbiddenColors
- the forbidden colors or nullList
of the generated Color
sgatherBlackAndWhite()
,
gatherBaseColors()
,
gatherBaseMoleculeColors(boolean)
,
gatherBaseColorsAndBaseMoleculeColors(boolean)
,
Color
public static final java.util.List<java.awt.Color> generateColors(int count)
Color
s, with no forbidden colors. If
there are too many required colors (greater than 224), this function throws
IllegalArgumentException
.count
- the number of the required colors between 1 and 224List
of the generated Color
spublic static final java.util.Collection<java.awt.Color> gatherBaseColors()
Collection
of the base colors.gatherBlackAndWhite()
,
gatherBaseMoleculeColors(boolean)
,
gatherBaseColorsAndBaseMoleculeColors(boolean)
,
Color
public static final java.util.Collection<java.awt.Color> gatherBaseMoleculeColors(boolean onLightBackground)
Collection
of the base Molecule RGB colors.onLightBackground
- true if the colors will be displayed on a light background, false if not.gatherBlackAndWhite()
,
gatherBaseColors()
,
gatherBaseColorsAndBaseMoleculeColors(boolean)
,
Color
public static final java.util.Collection<java.awt.Color> gatherBaseColorsAndBaseMoleculeColors(boolean onLightBackground)
Collection
of the base Molecule RGB colors and base colors.onLightBackground
- true if the colors will be displayed on a light background, false if not.gatherBlackAndWhite()
,
gatherBaseColors()
,
gatherBaseMoleculeColors(boolean)
,
Color
public static final java.util.Collection<java.awt.Color> gatherBlackAndWhite()
Collection
of black and white colorgatherBaseColors()
,
gatherBaseMoleculeColors(boolean)
,
gatherBaseColorsAndBaseMoleculeColors(boolean)
,
Color