Host sends: DCS $ q m ST (DECRQSS with the control function part of SGR as the setting).One sends the DECRQSS (Request Selection or Setting) sequence to request the current graphic rendition, and the terminal responds by sending the DECRPSS (Report Selection or Setting). The same goes for whole families of real terminals.ĭEC VT525 terminals implement a read-out mechanism, but have a set of control sequences that bears no relationship to those used by xterm. The built-in terminal emulators in the Linux kernel and the various BSD kernels are different terminal types, for example, and don't implement any such control sequences at all. mikeserv has shown you the control sequences that the xterm terminal emulator responds to. They provide control sequences that a program can send to the terminal, that cause it to send back information about its internal state, as terminal input.
#HOW TO CHANGE CURSOR COLOR XTERM SERIAL#
That said, some terminals include a mechanism for reading out such information as part of their terminal protocol, that is sent over that serial link. But for a real terminal this information is in some RAM location on a physically separate machine connected via a serial link. colour and attributes), is on the machine itself and is theoretically accessible. With a terminal emulator such as xterm or the one built into an operating system kernel that provides the kernel virtual terminals, the internal state of the emulator, including its notion of the current "graphic rendition" (i.e. The control sequence processing of a terminal happens "inside" the terminal, wherever that happens to be.
In general, obtaining the current colours is impossible. for the background or for the foreground: printf '\033]10 ?\007' the xterm will push back into your terminal's input buffer a sequence like the following. I have serious doubts if this is likely to work in another terminal emulator, but in an xterm if you run.