I am new to Tcl. I am trying to call one proc in other proc for rich text formatting. The proc for changing color of font looks like this :
proc color {foreground text} {
# for colored font
return [exec tput setaf $foreground]$text[exec tput sgr0]
}
This works with puts "[color 3 SomeText]"
. However I have another proc which contains text and looks like this,
proc Text {} {
puts stdout "SOMETEXT"
}
Here I want to have colored "SOMETEXT". I tried (wild guess) puts stdout "[color 3 SOMETEXT]"
but it did not work. I think there is something to do with global and private environment. I came across these links 1, 2 but did not provided me what i am looking for.
I understand that i can put my text in proc color {}
but my application prevents me doing that. So, to conclude, Is is possible to call proc color {}
inside proc text {}
?
P.S. : I am using tclsh from linux terminal.