Class ColorConfigKey
Some of the colours come from Paul Tol's colour scheme notes; see Paul Tol's Notes page and SRON/EPS/TN/09-002. The version of the Tech Note used here is dated 29 December 2012.
- Since:
- 9 Sep 2014
- Author:
- Mark Taylor
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionColorConfigKey(ConfigMeta meta, String dfltName, boolean allowHide) Constructs a config key using the default colour option list.ColorConfigKey(ConfigMeta meta, String dfltName, boolean allowHide, Map<String, Color> colorOpts) Constructs a config key using a supplied colour option list. -
Method Summary
Modifier and TypeMethodDescriptionReturns the default plotting colours used by TOPCAT, at least in early versions.static ConfigMetacreateColorMeta(String shortName, String longName, String theItem) Returns a metadata object suitable for use with a ColorConfigKey.Constructs a graphical control with which the user can specify a suitable value for association with this key.Returns a group of colours using the second (5-colour) row of figure 13 in SRON/EPS/TN/09-002.Returns a group of colours using the fourth (7-colour) row of figure 13 in SRON/EPS/TN/09-002.Returns a group of colours based on the "Alternative Colour Scheme" on Paul Tol's page, but not in the TechNode.static ColordecodeColorName(String sval) Turns a string into a colour by looking at known colour names or using RRGGBB syntax.decodeString(String sval) Takes a string, and attempts to turn it into an object which may be a value for this key.static Color[]Returns an array of the colour options suitable for plotting normal markers.stringifyValue(Color color) Takes an object which may be a value of this key, and attempts to turn it into a string for reporting purposes.Methods inherited from class ChoiceConfigKey
addOption, getOptionMap, stringToValue, valueToStringMethods inherited from class ConfigKey
cast, getDefaultValue, getMeta, getValueClass, toString
-
Field Details
-
SRON5_COLORS
-
SRON7_COLORS
-
SRONBRIGHT_COLORS
-
CLASSIC_COLORS
-
COLORNAME_RED
-
COLORNAME_BLACK
-
COLORNAME_GREY
-
COLORNAME_LIGHTGREY
-
-
Constructor Details
-
ColorConfigKey
Constructs a config key using the default colour option list.The supplied
dfltNamenames one of the colours in the default map. The static finalCOLORNAME_*members are guaranteed to be represented. If null is supplied, a sensible default (the first in the list) is used.- Parameters:
meta- metadatadfltName- name of default colour, or nullallowHide- true if hiding the colour, which results in a null value, is a legal option
-
ColorConfigKey
public ColorConfigKey(ConfigMeta meta, String dfltName, boolean allowHide, Map<String, Color> colorOpts) Constructs a config key using a supplied colour option list.- Parameters:
meta- metadatadfltName- name of default colour; should be one of the keys incolorOptsor nullallowHide- true if hiding the colour, which results in a null value, is a legal optioncolorOpts- name-> colour map
-
-
Method Details
-
decodeString
Description copied from class:ChoiceConfigKeyTakes a string, and attempts to turn it into an object which may be a value for this key. If the string is not of a recognised form, null is returned.This method should be the opposite of
ChoiceConfigKey.stringifyValue(T), but does not need to be consistent withstringToValueorvalueToString.- Specified by:
decodeStringin classChoiceConfigKey<Color>- Parameters:
sval- string representation- Returns:
- typed object represented by sval, or null
-
stringifyValue
Description copied from class:ChoiceConfigKeyTakes an object which may be a value of this key, and attempts to turn it into a string for reporting purposes.This method should if possible be the opposite of
ChoiceConfigKey.decodeString(String), but does not need to be consistent withstringToValueorvalueToString. If no round-trippable value is available, null should be returned.- Specified by:
stringifyValuein classChoiceConfigKey<Color>- Parameters:
color- typed object- Returns:
- string representing object, or null
-
createSpecifier
-
createColorMeta
Returns a metadata object suitable for use with a ColorConfigKey. The standard colour set is used.- Parameters:
shortName- key name for use in command-line interfacelongName- key name for use in GUItheItem- description of the item to use in free-form text, for instance "the plot grid"- Returns:
- colour config metadata
-
decodeColorName
-
getPlottingColors
Returns an array of the colour options suitable for plotting normal markers.- Returns:
- colour option array
-
createClassicColors
-
createSron5Colors
-
createSron7Colors
-
createSronBrightColors
-