Class CDK2DAtomColors
- java.lang.Object
-
- org.openscience.cdk.renderer.color.CDK2DAtomColors
-
- All Implemented Interfaces:
Serializable
,IAtomColorer
public class CDK2DAtomColors extends Object implements IAtomColorer, Serializable
Gives a short table of atom colors for 2D display. The coloring is loosely based on Jmol CPK. The internal color map can be modified by invoking the set method. For convenience the set method returns the colorer instance for chaining.IAtomColorer colorer = new CDK2DAtomColors().set("H", Color.LIGHT_GRAY) .set("O", Color.RED.lighter());
- See Also:
- CPK coloring, Jmol, Colors, Serialized Form
- Source code:
- main
- Belongs to CDK module:
- render
-
-
Constructor Summary
Constructors Constructor Description CDK2DAtomColors()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Color
getAtomColor(IAtom atom)
Returns the color for a certain atom type.Color
getAtomColor(IAtom atom, Color defaultColor)
Returns the color for a certain atom type, and uses the given default color if it fails to identify the atom type.
-
-
-
Method Detail
-
getAtomColor
public Color getAtomColor(IAtom atom)
Returns the color for a certain atom type.- Specified by:
getAtomColor
in interfaceIAtomColorer
- Parameters:
atom
- the atom whose color is desired- Returns:
- the color of the specified atom
-
getAtomColor
public Color getAtomColor(IAtom atom, Color defaultColor)
Returns the color for a certain atom type, and uses the given default color if it fails to identify the atom type.- Specified by:
getAtomColor
in interfaceIAtomColorer
- Parameters:
atom
- the atom in questiondefaultColor
- the color to use if the atom type of this atom cannot be identified- Returns:
- the color of the specified atom
-
-