public class ColorConfigKey extends ChoiceConfigKey<Color>
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.
Modifier and Type | Field and Description |
---|---|
static Map<String,Color> |
CLASSIC_COLORS |
static String |
COLORNAME_BLACK
Standard colour name for black.
|
static String |
COLORNAME_GREY
Standard colour name for grey.
|
static String |
COLORNAME_LIGHTGREY
Standard colour name for light grey.
|
static String |
COLORNAME_RED
Standard colour name for red.
|
static Map<String,Color> |
SRON5_COLORS |
static Map<String,Color> |
SRON7_COLORS |
static Map<String,Color> |
SRONBRIGHT_COLORS |
Constructor and Description |
---|
ColorConfigKey(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.
|
Modifier and Type | Method and Description |
---|---|
static Map<String,Color> |
createClassicColors()
Returns the default plotting colours used by TOPCAT, at least in
early versions.
|
static ConfigMeta |
createColorMeta(String shortName,
String longName,
String theItem)
Returns a metadata object suitable for use with a ColorConfigKey.
|
Specifier<Color> |
createSpecifier()
Constructs a graphical control with which the user can
specify a suitable value for association with this key.
|
static Map<String,Color> |
createSron5Colors()
Returns a group of colours using the second (5-colour) row
of figure 13 in SRON/EPS/TN/09-002.
|
static Map<String,Color> |
createSron7Colors()
Returns a group of colours using the fourth (7-colour) row
of figure 13 in SRON/EPS/TN/09-002.
|
static Map<String,Color> |
createSronBrightColors()
Returns a group of colours based on the "Alternative Colour Scheme"
on Paul Tol's page, but not in the TechNode.
|
static Color |
decodeColorName(String sval)
Turns a string into a colour by looking at known colour names
or using RRGGBB syntax.
|
Color |
decodeString(String sval)
Takes a string, and attempts to turn it into an object which may
be a value for this key.
|
static Color[] |
getPlottingColors()
Returns an array of the colour options suitable for plotting
normal markers.
|
String |
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.
|
addOption, getOptionMap, stringToValue, valueToString
cast, getDefaultValue, getMeta, getValueClass, toString
public static final String COLORNAME_RED
public static final String COLORNAME_BLACK
public static final String COLORNAME_GREY
public static final String COLORNAME_LIGHTGREY
public ColorConfigKey(ConfigMeta meta, String dfltName, boolean allowHide)
The supplied dfltName
names one of the colours in the
default map. The static final COLORNAME_*
members
are guaranteed to be represented.
If null is supplied, a sensible default (the first in the list)
is used.
meta
- metadatadfltName
- name of default colour, or nullallowHide
- true if hiding the colour, which results in a null
value, is a legal optionpublic ColorConfigKey(ConfigMeta meta, String dfltName, boolean allowHide, Map<String,Color> colorOpts)
meta
- metadatadfltName
- name of default colour;
should be one of the keys in colorOpts
or nullallowHide
- true if hiding the colour, which results in a null
value, is a legal optioncolorOpts
- name-> colour mappublic Color decodeString(String sval)
ChoiceConfigKey
This method should be the opposite of ChoiceConfigKey.stringifyValue(T)
,
but does not need to be consistent with
stringToValue
or
valueToString
.
decodeString
in class ChoiceConfigKey<Color>
sval
- string representationpublic String stringifyValue(Color color)
ChoiceConfigKey
This method should if possible
be the opposite of ChoiceConfigKey.decodeString(java.lang.String)
,
but does not need to be consistent with
stringToValue
or
valueToString
.
If no round-trippable value is available, null should be returned.
stringifyValue
in class ChoiceConfigKey<Color>
color
- typed objectpublic Specifier<Color> createSpecifier()
ConfigKey
createSpecifier
in class ConfigKey<Color>
public static ConfigMeta createColorMeta(String shortName, String longName, String theItem)
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"public static Color decodeColorName(String sval)
sval
- string colour identifierpublic static Color[] getPlottingColors()
public static Map<String,Color> createClassicColors()
public static Map<String,Color> createSron5Colors()
public static Map<String,Color> createSron7Colors()
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.