Term.jl icon indicating copy to clipboard operation
Term.jl copied to clipboard

Support white background terminals

Open goerz opened this issue 1 year ago • 3 comments

This library assumes that it is being used in a dark background terminal.

It would be great to be able to use it in white background terminal:

fa210621469e109f0b1b942c7248a782f4de7f59_2_290x500

  • There seem to be many hard-code color values, for example, the name of the scheme being printed in white in the above screenshot, from here: https://github.com/FedeClaudi/Term.jl/blob/4ab195d85c274e7cc869c1dc5bbce39778b5b5b7/src/theme.jl#L94-L105

    Similarly, there are lots of hard-coded values in errors.jl and logs.jl, which unfortunately makes the otherwise very nice install_term_logger and install_term_stacktrace impossible to use. All of these colors should refer to something configurable in the color scheme

  • There should be a switch to turn off all color, for monochrome or reduced-color terminals. The framed backtraces and such would be quite nice to have, but they should be rendered black on white (or white on black) in such environments

  • It would be nice to have a built-in colorscheme that is tested for readability on white background terminals.

  • The cherry on top would be to detect the background color of the terminal (e.g. via the COLORFGBG environment variable) and to choose the default scheme based on that.

goerz avatar Sep 07 '22 21:09 goerz

Hey,

Thanks for opening this issue, it's a very good point. I completely agree, all the hardcoded color values should be offloaded to the theme to allow complete customization. Further, there should be a few pre-defined themes for light/dark and readability, as you suggest.

It seems like a fairly easy fix, perfect for someone that wants to actively contribute to Term 😄 Would you be interested in working on a PR?

FedeClaudi avatar Sep 07 '22 21:09 FedeClaudi

Interested, yes 😀. Available, probably not (or at least I shouldn't).

Maybe I won't be able to help myself, so let's see. But if someone else wants to jump in, it would save me from the procrastination hole. 😉

goerz avatar Sep 07 '22 21:09 goerz

Hahah, it seems like we're on the same boat here!

Let's leave it open and see who gives in first 😉

FedeClaudi avatar Sep 07 '22 21:09 FedeClaudi