This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
In-Line Color Markup Support Script
Ro last edited by Ro
Recently I had a great idea that would allow Pythonista users to be able to use colorama (or other color markup) in their programs rather than using console functions!
How it would work
The program would run in the background as a thread and would intercept new stdout messages! Rather then being printed, the program would parse the message and check for color tags (eg. \033[44m)! If the program detects a color tag it could then change the color of the corrisponding text at the segment of the tag
With this: more PC python programs that can run on pythonista and use in-line color tags!!!
#  Example ... if r"\033" in message: # check for \033 colors color = parse_colors(message) # needed function sys.stdout.write(text_before_colorized) if color == "[44": # parsing console.set_color(0,0,1) sys.stdout.write(text_after_colorized) sys.stdout.write("\n") # ending print ... # There are many flaws with this example code but it shows the basic idea of how some of it would work! # ToDo: Parse multiple color codes in string # ToDo: Ignore r"messages" # ToDo: Ignore non-strings # ToDo: Make thread immune to KeyboardInturrupt # ToDo: Add kill method to thread # ToDo: Support multiple color markups # Error: >>> print "message", # would not remove the "\n" are parsing # End Result: # >>> print "normal color \033[44m blue color" # normal color blue color # ^ ^ this would be blue
I wanted to share this idea with the community because I can't find time to make it and rather than just let the good idea die: I would like to share it with people who may be intrested in using it!