jwlodek / py_cui

A python library for intuitively creating CUI/TUI interfaces with widgets, inspired by gocui.
https://jwlodek.github.io/py_cui-docs
BSD 3-Clause "New" or "Revised" License
752 stars 42 forks source link

Coloured text in TextBlocks #79

Open WalrusGumboot opened 3 years ago

WalrusGumboot commented 3 years ago

Is your feature request related to a problem? Please describe. I'm writing a UI for a program I made that uses candlestick charts. For those who aren't familiar, a candlestick chart is a diagram used in finance to visualise what is happening to a certain company, they look like this: image The colour of the bars is important here: green means the price rose, red means it dropped. I'm using a library called termgraph to draw them, and it in turn uses colorama to provide the colour. Describe the solution you'd like The ANSI escape codes (like \u001b[31m for red and \u001b[32m for green) should be rendered as that colour.

jwlodek commented 3 years ago

I agree that this would be a nice feature, but, as far as I know, curses (which is what py_cui uses under the hood for terminal rendering), does not support ANSI escape code based color markers. I think what would have to be done is to add functions that manually translate the escape codes into the supported format for the renderer, which would then convert those to curses commands to draw to the screen.

robermp commented 4 months ago

i'm also interested in this