Package chemaxon.marvin.util
Class ColorGenerator
- java.lang.Object
-
- chemaxon.marvin.util.ColorGenerator
-
@PublicAPI public final class ColorGenerator extends Object
A final class which provides a static access to a color distant color creator class. The result will be aList
ofColor
s which are distinguishable from each other and some specified other colors (typically from background colors). The order of the generatedColor
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.
Usage example:
If you need a nColor
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));
If you need n colors without any constraints:
List<Color> colors = ColorGenerator.generateColors(n);
- Since:
- 07.24.2011.
- See Also:
Color
,Collection
,List
,gatherBlackAndWhite()
,gatherBaseColors()
,gatherBaseMoleculeColors(boolean)
,gatherBaseColorsAndBaseMoleculeColors(boolean)
-
-
Constructor Summary
Constructors Constructor Description ColorGenerator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Collection<Color>
gatherBaseColors()
Creates aCollection
of the base colors.
These colors are:
- black
- white
- red
- green
- blue
- cyan
- magenta
- yellow.static Collection<Color>
gatherBaseColorsAndBaseMoleculeColors(boolean onLightBackground)
Creates aCollection
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 Collection<Color>
gatherBaseMoleculeColors(boolean onLightBackground)
Creates aCollection
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
- whitestatic Collection<Color>
gatherBlackAndWhite()
Creates aCollection
of black and white colorstatic List<Color>
generateColors(int count)
Generates the specified number of differentColor
s, with no forbidden colors.static List<Color>
generateColors(int count, Collection<Color> forbiddenColors)
Generates the specified number of differentColor
s, which are different enough from the specified forbidden colors.
-
-
-
Method Detail
-
generateColors
public static final List<Color> generateColors(int count, Collection<Color> forbiddenColors)
Generates the specified number of differentColor
s, which are different enough from the specified forbidden colors. If there are too many forbidden and required colors (greater than 224), this function throwsIllegalArgumentException
.- Parameters:
count
- the number of the required colors between 1 and 224forbiddenColors
- the forbidden colors or null- Returns:
- the
List
of the generatedColor
s - See Also:
gatherBlackAndWhite()
,gatherBaseColors()
,gatherBaseMoleculeColors(boolean)
,gatherBaseColorsAndBaseMoleculeColors(boolean)
,Color
-
generateColors
public static final List<Color> generateColors(int count)
Generates the specified number of differentColor
s, with no forbidden colors. If there are too many required colors (greater than 224), this function throwsIllegalArgumentException
.
-
gatherBaseColors
public static final Collection<Color> gatherBaseColors()
Creates aCollection
of the base colors.
These colors are:
- black
- white
- red
- green
- blue
- cyan
- magenta
- yellow.- Returns:
- the base colors
- See Also:
gatherBlackAndWhite()
,gatherBaseMoleculeColors(boolean)
,gatherBaseColorsAndBaseMoleculeColors(boolean)
,Color
-
gatherBaseMoleculeColors
public static final Collection<Color> gatherBaseMoleculeColors(boolean onLightBackground)
Creates aCollection
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- Parameters:
onLightBackground
- true if the colors will be displayed on a light background, false if not.- Returns:
- the base Molecule colors
- See Also:
gatherBlackAndWhite()
,gatherBaseColors()
,gatherBaseColorsAndBaseMoleculeColors(boolean)
,Color
-
gatherBaseColorsAndBaseMoleculeColors
public static final Collection<Color> gatherBaseColorsAndBaseMoleculeColors(boolean onLightBackground)
Creates aCollection
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.
and the following basic colors:
- black
- white
- red
- green
- blue
- cyan
- magenta
- yellow.- Parameters:
onLightBackground
- true if the colors will be displayed on a light background, false if not.- Returns:
- the collection of the base colors and base molecule colors
- See Also:
gatherBlackAndWhite()
,gatherBaseColors()
,gatherBaseMoleculeColors(boolean)
,Color
-
gatherBlackAndWhite
public static final Collection<Color> gatherBlackAndWhite()
Creates aCollection
of black and white color- Returns:
- the collection of the base colors and base molecule colors
- See Also:
gatherBaseColors()
,gatherBaseMoleculeColors(boolean)
,gatherBaseColorsAndBaseMoleculeColors(boolean)
,Color
-
-