Package org.jline.terminal.impl
Class ColorSupport
java.lang.Object
org.jline.terminal.impl.ColorSupport
Parses OSC 10/11 color query responses from the terminal.
Terminals that support OSC color queries respond with an escape sequence
containing the current foreground (OSC 10) or background (OSC 11) color
as an rgb:RRRR/GGGG/BBBB value. This class reads and decodes
those responses into a packed 24-bit RGB integer.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intparseColorResponse(NonBlockingReader reader, int colorType) Reads an OSC color response from the terminal and returns the color as a 24-bit RGB integer.
-
Method Details
-
parseColorResponse
Reads an OSC color response from the terminal and returns the color as a 24-bit RGB integer.- Parameters:
reader- non-blocking reader connected to the terminal inputcolorType- the OSC color type to match (10 for foreground, 11 for background)- Returns:
- the color as a packed 24-bit RGB integer (
0xRRGGBB), or-1if no valid response was received - Throws:
IOException- if an I/O error occurs while reading from the terminal
-