Package org.cytoscape.util.color
Interface Palette
-
public interface PaletteThis interface provides a consistent way for various providers (ColorBrewer, ColourLovers, etc.) to provide color palettes to Cytoscape routines.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Color[]getColors()Return the palette as an array of colorsColor[]getColors(int nColors)Return the palette as an array of colors of the requested length.ObjectgetIdentifier()Return the internal identifier of this palette.StringgetName()Return the name of this palette.default PaletteProvidergetPaletteProvider()Return the PaletteProvider for this palette.PaletteTypegetType()This is the type of the palette, using the Cynthia Brewer's classification.booleanisColorBlindSafe()Return true if the palette is color blind safe.intsize()Return the number of colors natively in the palette.StringtoString()Return the string representation of this palette (usually the name)
-
-
-
Method Detail
-
getName
String getName()
Return the name of this palette. This is intended to be the user-visible name, not the internal identifier.- Returns:
- user-visible name of this palette
-
getIdentifier
Object getIdentifier()
Return the internal identifier of this palette. This is the internal identifier of the palette which might be different for different providers. For example, BrewerPalettes use short names (e.g. RdBu), while ColourLovers uses an integer.- Returns:
- the internal identifier for this palette
-
getType
PaletteType getType()
This is the type of the palette, using the Cynthia Brewer's classification.- Returns:
- the palette type
-
size
int size()
Return the number of colors natively in the palette.- Returns:
- the number of colors in the palette
-
getColors
Color[] getColors()
Return the palette as an array of colors- Returns:
- the color array
-
getColors
Color[] getColors(int nColors)
Return the palette as an array of colors of the requested length. If the number of colors in the palette is less than the requested number, the colors will be interpolated.- Returns:
- the color array
-
isColorBlindSafe
boolean isColorBlindSafe()
Return true if the palette is color blind safe.- Returns:
- true if the palette is color blind safe
-
toString
String toString()
Return the string representation of this palette (usually the name)
-
getPaletteProvider
default PaletteProvider getPaletteProvider()
Return the PaletteProvider for this palette. Note that by default, this returns null so as not to break existing palette implementations.- Returns:
- the
PaletteProviderfor this palette
-
-