Terminal control/Inverse video

From Rosetta Code
Terminal control/Inverse video is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to display a word in inverse video followed by a word in normal video.


ZX Spectrum Basic

<lang basic> 10 INVERSE 1 20 PRINT "FOO"; 30 INVERSE 0 40 PRINT "BAR" </lang>


<lang PicoLisp>(prin "abc") (call "tput" "rev") (prin "def") # These three chars are displayed in reverse video (call "tput" "sgr0") (prinl "ghi")</lang>


This only works on Unix terminals. <lang tcl># Get how the terminal wants to do things... set videoSeq(reverse) [exec tput rev] set videoSeq(normal) [exec tput rmso] proc reverseVideo str {

   global videoSeq
   return "$videoSeq(reverse)${str}$videoSeq(normal)"


  1. The things to print

set inReverse "foo" set inNormal "bar"

  1. Print those words

puts "[reverseVideo $inReverse] $inNormal"</lang>