Terminal control/Inverse video: Difference between revisions
Content added Content deleted
(Example implementation in Tcl) |
m (→{{header|Tcl}}: Slightly clearer version) |
||
Line 5: | Line 5: | ||
This only works on Unix terminals. |
This only works on Unix terminals. |
||
<lang tcl># Get how the terminal wants to do things... |
<lang tcl># Get how the terminal wants to do things... |
||
set |
set videoSeq(reverse) [exec tput rev] |
||
set |
set videoSeq(normal) [exec tput rmso] |
||
proc reverseVideo str { |
|||
global videoSeq |
|||
return "$videoSeq(reverse)${str}$videoSeq(normal)" |
|||
} |
|||
# The things to print |
# The things to print |
||
Line 13: | Line 17: | ||
# Print those words |
# Print those words |
||
puts |
puts "[reverseVideo $inReverse] $inNormal"</lang> |
||
[[Category:Terminal Control]] |
[[Category:Terminal Control]] |
Revision as of 22:02, 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 videoSeq(reverse) [exec tput rev] set videoSeq(normal) [exec tput rmso] proc reverseVideo str {
global videoSeq return "$videoSeq(reverse)${str}$videoSeq(normal)"
}
- The things to print
set inReverse "foo" set inNormal "bar"
- Print those words
puts "[reverseVideo $inReverse] $inNormal"</lang>