Terminal control/Inverse video: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
(Example implementation in Tcl)
Line 1: Line 1:
{{draft task}}
{{draft task}}
The task is to display a word in inverse video followed by a word in normal video.
The task is to display a word in inverse video followed by a word in normal video.

=={{header|Tcl}}==
This only works on Unix terminals.
<lang tcl># Get how the terminal wants to do things...
set reverseVideoSeq [exec tput rev]
set normVideoSeq [exec tput rmso]

# The things to print
set inReverse "foo"
set inNormal "bar"

# Print those words
puts $reverseVideoSeq$inReverse$normVideoSeq$inNormal</lang>


[[Category:Terminal Control]]
[[Category:Terminal Control]]

Revision as of 21:59, 10 November 2010

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.

Tcl

This only works on Unix terminals. <lang tcl># Get how the terminal wants to do things... set reverseVideoSeq [exec tput rev] set normVideoSeq [exec tput rmso]

  1. The things to print

set inReverse "foo" set inNormal "bar"

  1. Print those words

puts $reverseVideoSeq$inReverse$normVideoSeq$inNormal</lang>