Lioness100/guess-that-lang

terminal colors on light background are not good

BartMassey opened this issue · 7 comments

Light gray on white is a little rough. I think there may also be some white-on-white. Need to set the code highlight colors to medium luminance by default and/or provide an argument to indicate light vs dark terminal.

Definitely related, but as far as I can tell even if Issue #5 is fixed some kind of policy thing will still have to be done: as far as I know the software can't tell whether its terminal is in light mode or dark mode.

I'm don't think I understand what you mean by that. dark-light has 62k downloads and the code looks pretty legit, so I'm sure it works.

Just looked at how the dark-light crate works. Turns out it ignores the terminal and guesses mode from what it finds by digging around in OS stuff. This probably works OK most of the time. If/when it does not you get this issue.

A good plan would be to default to some theme that works well across both dark and light modes unless dark-light can figure it out. I'll try a patch in a bit.

Yike. Just looked more closely. dark-light defaults to Light when it can't figure out what's going on. This seems weird and not so great. I'll poke at that as well.

Yeah, I don't see any better answer than, by default, using some theme and highlighting that works well on both light and dark screens. A command-line argument could be given to have dark-light try to guess instead.

I think the best option would be to copy bat's implementation: https://github.com/sharkdp/bat/blob/master/src/assets.rs#L72-L106.
(I copied their default themes anyway haha)

As for the CLI flag, I'm thinking just --theme light and --theme dark? Note: allowing the user to use custom themes would conflict with #9