Package org.jline.utils
Class ColorPalette
java.lang.Object
org.jline.utils.ColorPalette
Color palette
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ColorPaletteprivate Colors.Distanceprivate Stringprivate booleanprivate int[]private final Terminalstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionColorPalette(Terminal terminal) ColorPalette(Terminal terminal, String distance) -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if the terminal has the capability to change colors.private static int[]intgetColor(int index) Get a specific color in the paletteprotected Colors.DistancegetDist()Get the name of the distance to use for rounding colors.intGet the palette lengthbooleanisReal()booleanLoad the palette from the terminal.protected voidloadPalette(boolean doLoad) intround(int col) intround(int r, int g, int b) voidsetColor(int index, int color) Change the color of the palettevoidsetDistance(String name) Set the name of the color distance to use when rounding RGB colors to the palette.
-
Field Details
-
XTERM_INITC
- See Also:
-
DEFAULT
-
terminal
-
distanceName
-
distance
-
osc4
private boolean osc4 -
palette
private int[] palette
-
-
Constructor Details
-
ColorPalette
public ColorPalette() -
ColorPalette
- Throws:
IOException
-
ColorPalette
- Throws:
IOException
-
-
Method Details
-
getDistanceName
Get the name of the distance to use for rounding colors.- Returns:
- the name of the color distance
-
setDistance
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:
trueif the terminal can change colors
-
loadPalette
Load the palette from the terminal. If the palette has already been loaded, subsequent calls will simply returntrue.- Returns:
trueif the palette has been successfully loaded.- Throws:
IOException
-
loadPalette
- 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 colorcolor- 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
-
doLoad
- Throws:
IOException
-