magmax/python-inquirer

Change text color based on terminal background

ranshaa05 opened this issue · 1 comments

I've been using some programs that use Inquirer and I've noticed that on some terminals' backgrounds, some of the text is not always very readable due to its coloring, like in this example, where the selected item is barely readable:
image

I think changing the text color based on the terminal background can solve it, say, in my example, if the selection was green instead of blue.
this can be done by offsetting the background color's hex value, for example.

There are only 6 different colors (8 if you count black/white) in the basic ANSI command set and only these can be assumed to work general purpose. So the default theme only uses these. The user can theme this colors in his terminal-emulator to match his preferences, if he wants to.

If you belive the default theme could be improved, feel free to open a PR.

If you want a custom experience for your program using inquirer, you can define your own theme. There you can use the full set of colors as defined by blessed to your liking. You can even try to implement the hex-offset you suggested, but I am pretty sure this can't be implemented reliably.