Closed bramstoeller closed 2 years ago
it would be needed to consider also the colors inside of text, bold etc. not only same color of a menu item
I just needed a colored text without bolding, etc. and played around a bit with the ansicolor
library... I got it to work as far as I need it by changing the row
function in menu_component.py
. But I have not tested extensively if there would be any issues in more complex menus / situations to what I use - I have a feeling that alignment (especially centered) may cause issues with my quick fix. And of course, it needs the additional dependency.
But if interested, I'd be happy to share what I did. I'm not exactly a git master, so not sure if I'll be able to manage a pull request but in any case could post the code here...
Colors are now supported as of v0.7.0. See example6.py for an example of using colors in menu item text.
I'd like to create colored menu items. I tried using colorama (e.g.
Fore.RED + "Menu Item" + Style.RESET_ALL
, but this resulted in the menu border being messed up, probably because the color code characters are counted as normal characters but don't take up any screen space.I saw some notes about color support in
console_menu.py
. Is someone working on this? Does anyone have some ideas about it? I'd be happy to implement this part, but it would be good to have some discussion about the API. How should a user define the color of a menu item? Obviously we could add acolor
argument toMenuItem
, but how would we handle items in aSelectionMenu
?And then, colors are quite tricky, with all kinds of OS and stream dependent stuff. So I'd propose to use colorama for it. We could say that colored menu items are only supported if the colorama package is installed as well, without making it a hard requirement.