dvdhrm / kmscon

Linux KMS/DRM based virtual Console Emulator
http://www.freedesktop.org/wiki/Software/kmscon
Other
429 stars 78 forks source link

tsm: support background color lightening via blink attribute #100

Closed ku1ik closed 10 years ago

ku1ik commented 10 years ago

According to http://misc.flogisoft.com/bash/tip_colors_and_formatting#terminals_compatibility several terminal emulators (Linux TTY included) use blink to set high-intensity background color. Rxvt doc states it as well: https://github.com/exg/rxvt-unicode/blob/master/README.FAQ#L319-L324

ku1ik commented 10 years ago

I have libtsm with this change already running in production (in ascii.io project). I reprocessed ~5000 terminal sessions with great success so I can say it's battle tested already.

dvdhrm commented 10 years ago

The patch looks good, except for a missing xterm reference. I try to follow: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html The reason is, a lot of terminal emulators implement their own crap and I want to avoid introducing one more independent implementation. That's why I have this policy to stick close to xterm behavior.

So I tested the blink-attribute in xterm and it actually just blinks the text. It doesn't add lighter background or bold so I am kind of reluctant to merge this as it is. How about a helper (tsm_screen_attr_brighten_bg) which takes a tsm_screen_attr and brightens the background color? This can be called by your render-engine if it sees "blink = 1;" but doesn't support blink. Or call it "tsm_screen_attr_blink_compat()" to avoid external policies. Comments?

Btw., I am currently polishing up github.com/dvdhrm/libtsm feel free to resubmit your v2 there.

ku1ik commented 10 years ago

So, actually I'm not using RGB values prepared by tsm, I operate solely on fccode/bccode/bold/underline/blink attributes and based on them I apply specific CSS class to the text displayed in the ascii.io player.

I added background color lightening to the RGB generation because I thought it would be kinda consistent with the foreground color lightening (that was already in place). The only thing I actually care about is "blink" bit on screen attribute struct. And I'm totally fine with not implementing bg lightening in libtsm itself. Actually it makes sense to leave the decision "to blink or to lighten or to ignore" for the actual terminal implementers.

I'm resubmitting the patch to the dvdhrm/libtsm.