Class ColourPalette


  • public class ColourPalette
    extends Object
    • Constructor Detail

      • ColourPalette

        public ColourPalette​(Color[] palette,
                             int numColorBands)
    • Method Detail

      • setDefaultPalette

        public static boolean setDefaultPalette​(String paletteStr)
        Overrides the default palette
        Parameters:
        paletteStr - The palette (pre-defined or otherwise) to use as the default
        Returns:
        Whether or not the operation was successful.
      • getColor

        public Color getColor​(float value)
        Gets the colour corresponding to a fractional point along the palette
        Parameters:
        value - The fraction along the palette of the colour
        Returns:
        The desired colour
      • fromString

        public static ColourPalette fromString​(String paletteString,
                                               int nColourBands)
        Gets a ColourPalette from a string representation of it
        Parameters:
        paletteString - Either the name of a predefined palette, or a string defining a palette. This is a comma, colon, or newline separated list of colours (see GraphicsUtils.parseColour(String) for valid colour formats)
        nColourBands - The number of colour bands to use in the palette.
        Returns:
        The desired ColourPalette
      • getPredefinedPalettes

        public static Set<String> getPredefinedPalettes()