B4J Question Console or terminal GUI like "Rich" in python

mbenam

Member
Hi all,

is there any library for creating colored text or GUI on the terminal or console similar to the Rich library in python? Any pointer on how to achieve this on windows would be appreciated as well.

Thanks.

Capture.JPG
 

mbenam

Member
Thanks Erel. How would I add an ANSI escape sequence like this \x1b[1;31m in front of a string and then do a log statement. I believe this sets the output as bold red. \x1b is the Control key, 1 sets it as bold and 31 sets it as red.

Thanks.
 
Upvote 0

mbenam

Member
I figured it out.

B4X:
Sub AppStart (Args() As String)
    'Dim bc As ByteConverter
    Dim s As String
    s = Chr(27) & "[1;31m"
    
    Log(s & "Hello")
End Sub
 
Upvote 1

mbenam

Member
I tested in Gitbash on windows. You can try to install PowerShell 7. It has capability to emulate ANSI terminal. You can google for it. Involves changing registry setting. Without changing registry setting you can also try to run your file like this which may work.
B4X:
java -jar myProgram.jar | Out-Host
 
Upvote 0
Top