Get current terminal color pair in Perl

I am trying to find out about color text in a terminal window. (In case this is important, I use Terminal.app in OS X.) I would like to get the current foreground and background pair. It looks like I can get this information in a perl script using the Term :: Cap library, but the solution eludes me.

In a perl script, how would I query the value of the current foreground and background color pair?

+3
source share
3 answers

This function is beyond the scope of terminfo and termcap because it deals with terminal responses, and terminfo / termcap describes these features:

  • how to tell the terminal that it performs some often performed function (for example, cleaning the screen) or
  • - (, Home) .

, , 1980- . , (, ). , terminfo/termcap X/Open Curses. ncurses , , - , .

Terminal.app xterm, ( ) . , xterm , , . ( xtermset xtermcontrol), (, , ). xtermcontrol , Terminal.app — . :

screenshot showing Terminal.app vs xterm using xtermcontrol

+2

, - , termcap terminfo - . , , . ECMA-48 ( "ANSI" ANSI X3.64, ), , , SGR "Set Graphic Rendition", .

+2

Source: https://habr.com/ru/post/1791905/


All Articles