APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.org.jline.utils

public Class ColorPalette

extends Object
Class Inheritance
Imports
java.io.IOException, .PrintWriter, java.util.ArrayList, .Arrays, .List, jdk.internal.org.jline.terminal.Terminal

Color palette

Field Summary

Modifier and TypeField and Description
public static final ColorPalette
private Colors.Distance
private String
private boolean
private int[]
private final Terminal
public static final String

Constructor Summary

AccessConstructor and Description
public
public
public
ColorPalette(Terminal terminal, String distance)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the terminal can change colors
canChange
()

Check if the terminal has the capability to change colors.

private static int[]
doLoad(Terminal terminal)

public int

Returns:

the color at the given index
getColor
(int
the index of the color
index
)

Get a specific color in the palette

protected Colors.Distance
public String

Returns:

the name of the color distance
getDistanceName
()

Get the name of the distance to use for rounding colors.

public int

Returns:

the palette length
getLength
()

Get the palette length

public boolean
public boolean

Returns:

true if the palette has been successfully loaded.
loadPalette
()

Load the palette from the terminal.

protected void
loadPalette(boolean doLoad)

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

public int
round(int col)

public void
setColor(int
the index of the color
index
,
int
the new color value
color
)

Change the color of the palette

public void
setDistance(String
the name of the color distance
name
)

Set the name of the color distance to use when rounding RGB colors to the palette.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

DEFAULTback to summary
public static final ColorPalette DEFAULT
distanceback to summary
private Colors.Distance distance
distanceNameback to summary
private String distanceName
osc4back to summary
private boolean osc4
paletteback to summary
private int[] palette
terminalback to summary
private final Terminal terminal
XTERM_INITCback to summary
public static final String XTERM_INITC

Constructor Detail

ColorPaletteback to summary
public ColorPalette()
ColorPaletteback to summary
public ColorPalette(Terminal terminal) throws IOException
ColorPaletteback to summary
public ColorPalette(Terminal terminal, String distance) throws IOException
Annotations
@SuppressWarnings:this-escape

Method Detail

canChangeback to summary
public boolean canChange()

Check if the terminal has the capability to change colors.

Returns:boolean

true if the terminal can change colors

doLoadback to summary
private static int[] doLoad(Terminal terminal) throws IOException
getColorback to summary
public int getColor(int index)

Get a specific color in the palette

Parameters
index:int

the index of the color

Returns:int

the color at the given index

getDistback to summary
protected Colors.Distance getDist()
getDistanceNameback to summary
public String getDistanceName()

Get the name of the distance to use for rounding colors.

Returns:String

the name of the color distance

getLengthback to summary
public int getLength()

Get the palette length

Returns:int

the palette length

isRealback to summary
public boolean isReal()
loadPaletteback to summary
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:boolean

true if the palette has been successfully loaded.

loadPaletteback to summary
protected void loadPalette(boolean doLoad) throws IOException
roundback to summary
public int round(int r, int g, int b)
roundback to summary
public int round(int col)
setColorback to summary
public void setColor(int index, int color)

Change the color of the palette

Parameters
index:int

the index of the color

color:int

the new color value

setDistanceback to summary
public void setDistance(String name)

Set the name of the color distance to use when rounding RGB colors to the palette.

Parameters
name:String

the name of the color distance

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override