Various coloring scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
589 B

#Returns color codes that are in string
# IN: string
# OUT: list
proc getColorWord {text} {
return [lindex [regexp -inline -- {%\^(\w+)%\^} $text] 1]
}
#Tells whether this color code one that causes bold vt sequence
# IN: word
# OUT: boolean
proc boldWord {word} {
if {$word == "BOLD" || $word == "YELLOW"} {
return 1
} else {
return 0
}
}
#Word Wrapper
# IN: max line lenght
# string
# OUT: string
proc wordWrap {max msg} {
if { [string length $msg] > $max } {
regsub -all "(.{1,$max})( +|$)" $msg "\\1\\3\n" msg
}
return $msg
}