Pedantic polishing of code to please FlexeLint.Approved by: ed
Add teken_256to16() to convert xterm-256 256-color codes to xterm 16-colorcodes. This will be used to fix bright colors.Improve teken_256to8(). Use a lookup table instead of calculations. Thec
Add teken_256to16() to convert xterm-256 256-color codes to xterm 16-colorcodes. This will be used to fix bright colors.Improve teken_256to8(). Use a lookup table instead of calculations. Thecalculations were inaccurate since they used indexes into the xterm-2566x6x6 color map instead of actual xterm colors. Also, change the thresholdfor converting to a primary color: require the primary's component to be2 or more higher instead of just higher. This affects about 1/5 of thetable entries and gives uniformly distributed colors in the 6x6x6 submapexcept for greys (35 entries each for red, green, blue, cyan, brown andmagenta, instead of approx. only 15 each for the mixed colors). Evenmore mixed colors would be better for matching colors, but uniformdistribution is best for preserving contrast.For teken_256to16(), bright colors are just the ones with luminosity >=60%. These are actually light colors (more white instead of moresaturation), while xterm bright colors except for white itself areactually saturated with no white, so have luminosity only 50%.These functions are layering violations. teken cannot do correctconversions since it shouldn't know the color maps of anything exceptxterm. Translating through xterm-16 colors loses information. Thisgives bugs like xterm-256 near-brown -> xterm-16 red -> VGA red.
show more ...
mdoc: improvements to SEE ALSO.
Fix whitespace inconsistencies found in homegrown Symbol.maps.
Fix various whitespace inconsistencies in sys/teken.
mdoc: reorder sections consistently
Add proper build infrastructure for teken.I'm not sure whether we should install teken as a library on any stockFreeBSD installation, but I can imagine people want to tinker aroundwith it now and
Add proper build infrastructure for teken.I'm not sure whether we should install teken as a library on any stockFreeBSD installation, but I can imagine people want to tinker aroundwith it now and then. Create a /sys/teken/libteken, which holds aMakefile to install a shared library version of the terminal emulator,complete with a manpage.Also add Makefiles for the demo/stress applications, to build it againstthe shared library.