vinay
vinay

Reputation: 51

Can we color Code or have colored display for puts in tcl?

i have some output in tcl which is printed using puts like this:

puts "hello world"

can we print the same in different color?

Upvotes: 1

Views: 6236

Answers (1)

Roman Kaganovich
Roman Kaganovich

Reputation: 658

You need to use ANSI Escape sequences

For example, to print line in bold red color:

puts -nonewline "\033\[1;31m"; #RED
puts "My RED String"
puts -nonewline "\033\[0m";# Reset

enter image description here

Upvotes: 2

Related Questions