Package chemaxon.marvin.util
Class ColorGenerator
java.lang.Object
chemaxon.marvin.util.ColorGenerator
A final class which provides a static access to a color distant color creator class. The result
will be a
Usage example:
If you need a n
If you need n colors without any constraints:
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.Usage example:
If you need a n
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));
If you need n colors without any constraints:
List<Color> colors = ColorGenerator.generateColors(n);
- Since:
- 07.24.2011.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<Color>
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>
Creates aCollection
of black and white colorgenerateColors
(int count) Generates the specified number of differentColor
s, with no forbidden colors.generateColors
(int count, Collection<Color> forbiddenColors) Generates the specified number of differentColor
s, which are different enough from the specified forbidden colors.
-
Constructor Details
-
ColorGenerator
public ColorGenerator()
-
-
Method Details
-
generateColors
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
. -
generateColors
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
Creates aCollection
of the base colors.
These colors are:
- black
- white
- red
- green
- blue
- cyan
- magenta
- yellow.- Returns:
- the base colors
- See Also:
-
gatherBaseMoleculeColors
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:
-
gatherBaseColorsAndBaseMoleculeColors
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
Creates aCollection
of black and white color- Returns:
- the collection of the base colors and base molecule colors
- See Also:
-