Class NamedColorSet

java.lang.Object
uk.ac.starlink.ttools.plot2.config.NamedColorSet

public abstract class NamedColorSet extends Object
Defines a set of colours with associated names. This is quite like a map, but the colours can be retrieved with variant keys (modified spellings, case folding etc). A couple of useful instances are supplied.
Since:
23 Feb 2017
Author:
Mark Taylor
  • Field Details

  • Constructor Details

    • NamedColorSet

      public NamedColorSet(Map<String,Color> map)
      Constructor.
      Parameters:
      map - name->color map
  • Method Details

    • getMap

      public Map<String,Color> getMap()
      Returns the colour map on which this named set is based.
      Returns:
      map
    • getColor

      public Color getColor(String name)
      Returns the colour for a given name. This name is normalised using the toKey(java.lang.String) method before matching.
      Parameters:
      name - approximate name
      Returns:
      colour, or null
    • toKey

      public abstract String toKey(String name)
      Normalises a colour name to turn it into a map key.
      Parameters:
      name - approximate name
      Returns:
      name used for matching