Class ColorPalette

java.lang.Object
org.jline.utils.ColorPalette

public class ColorPalette extends Object
Color palette for terminal color management and conversion.

The ColorPalette class provides functionality for managing terminal colors, including color conversion between different formats (RGB, ANSI, indexed), color distance calculation, and color remapping. It helps bridge the gap between the different color capabilities of various terminals.

This class supports various terminal color modes:

  • 8-color mode (standard ANSI colors)
  • 16-color mode (standard ANSI colors + bright variants)
  • 256-color mode (indexed colors)
  • 24-bit true color mode (RGB colors)

The palette can be used to convert between these color modes, find the closest matching color in a more limited palette, and even modify the terminal's color palette on supported terminals.

This class is used internally by JLine components to handle color output across different terminal types with varying color support capabilities.