Does the Viewer State Browser support colored text?
It'd be great to be able to use some color for debug information in the Viewer State Browser. Usually I do this in python like this:
classbcolors:HEADER='\033[95m'OKBLUE='\033[94m'OKCYAN='\033[96m'OKGREEN='\033[92m'WARNING='\033[93m'FAIL='\033[91m'ENDC='\033[0m'BOLD='\033[1m'UNDERLINE='\033[4m'print(bcolors.WARNING+"Warning: No active frommets remain. Continue?"+bcolors.ENDC)
But using self.log and bcolors doesn't work.
self.log(bcolors.OKBLUE+"blue text"+bcolors.ENDC)
Just prints '[94mblue text[0m' to the viewer state browser
State browser is qt based so it's not your usual shell.
It does support rich text however. For log viewer you can use qt html subset for formatting which can do much more than colors actually: https://doc.qt.io/qt-5/richtext-html-subset.html [doc.qt.io]
Basically this:
self.log("<span style='font-weight:bold; color:#00FF00;'>== Enter ==</span>")
self.log("Input doesn't have name attribute",severity=hou.severityType.Warning)
These modules (additional python utils like resourceutils or viewerstates.utils) aren't documented but you can check their source, they have many other useful things