Welcome!
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.
Colorama, see characters in color?
-
Hi al,
I have installed the package colorama but it seems that the console color characters are not displayed.Minimal sample:
from colorama import Fore, Back, Style print(Fore.RED + 'some red text') print(Back.GREEN + 'and with a green background') print(Style.DIM + 'and in dim text') print(Style.RESET_ALL) print('back to normal now')
Output:
[31msome red text [42mand with a green background [2mand in dim text [0m back to normal now
Does it alternative?
Best, David -
-
The
[31m
and such that you're seeing there are ANSI escape codes, which almost all terminal programs support for changing foreground/background color and other text formatting. Pythonista's console isn't a normal terminal emulator though, so it doesn't support many terminal-like features, like escape codes. In Pythonista you can change the console text color using theconsole.set_color
function that @ccc linked above. -
Hi, then, this not what can I do?...
https://github.com/tartley/colorama/raw/master/screenshots/ubuntu-demo.png
-
Hi, then, this not what can I do?...
Depends on your definition of this. You cannot set the background color but you can set the text color and font. Just follow the link provided by @ccc or use the Pythonista documentation and look up the
console
module. -
Hi, Many thanks to all. I will follow these indications.
I believe that they are sufficient for now.