gyscos / cursive

A Text User Interface library for the Rust programming language
MIT License
4.26k stars 243 forks source link

Light colors do not work in linux TTY #58

Open gyscos opened 8 years ago

gyscos commented 8 years ago

Using the "outset" border style in a linux TTY prints black cells instead of the light white borders. It should probably use the main color with the bold attribute.

gyscos commented 8 years ago

Indeed, "light" colors in the linux TTY are achieved using the bold attribute (which doesn't result in actual bold text, just lighter color). When applying a color, we'll then need to:

So on linux TTY, we'll need to actually use the darker color. This means the color pair should be initialized with the darker color. But in this case, how does it know that it should activate the bold attribute, since the color pair content will just show a dark color?

One solution is to move to termion right now, but I'm not sure has_colors is available (plus, a few other things aren't stable yet). Alternatively, we need ncurses to know that a color pair imply a new attribute. This can come from a global variable that maps color pair to extra attributes? That's not great, but ncurses already has a global color pairs configuration, so it's not much worse...

gyscos commented 7 years ago

Backends now have an inner state, so it'll be easier to remember which color needs to be faked with a bold effect.