Class ColorSupport


  • public class ColorSupport
    extends java.lang.Object
    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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int parseColorResponse​(NonBlockingReader reader, int colorType)
      Reads an OSC color response from the terminal and returns the color as a 24-bit RGB integer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • parseColorResponse

        public static int parseColorResponse​(NonBlockingReader reader,
                                             int colorType)
                                      throws java.io.IOException
        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 input
        colorType - the OSC color type to match (10 for foreground, 11 for background)
        Returns:
        the color as a packed 24-bit RGB integer (0xRRGGBB), or -1 if no valid response was received
        Throws:
        java.io.IOException - if an I/O error occurs while reading from the terminal