Class ColorPalette


  • public class ColorPalette
    extends Object
    Color palette
    • Method Detail

      • getDistanceName

        public String getDistanceName()
        Get the name of the distance to use for rounding colors.
        Returns:
        the name of the color distance
      • setDistance

        public void setDistance​(String name)
        Set the name of the color distance to use when rounding RGB colors to the palette.
        Parameters:
        name - the name of the color distance
      • canChange

        public boolean canChange()
        Check if the terminal has the capability to change colors.
        Returns:
        true if the terminal can change colors
      • loadPalette

        public boolean loadPalette()
                            throws IOException
        Load the palette from the terminal. If the palette has already been loaded, subsequent calls will simply return true.
        Returns:
        true if the palette has been successfully loaded.
        Throws:
        IOException
      • getLength

        public int getLength()
        Get the palette length
        Returns:
        the palette length
      • getColor

        public int getColor​(int index)
        Get a specific color in the palette
        Parameters:
        index - the index of the color
        Returns:
        the color at the given index
      • setColor

        public void setColor​(int index,
                             int color)
        Change the color of the palette
        Parameters:
        index - the index of the color
        color - the new color value
      • isReal

        public boolean isReal()
      • round

        public int round​(int r,
                         int g,
                         int b)
      • round

        public int round​(int col)
      • getDist

        protected org.jline.utils.Colors.Distance getDist()