How can I get 256 color support on FreeBSD 13 headless machine using console/terminal?
I have an overkill GPU "AMD Radeon PRO WX 2100" installed to the machine.
Basically want to avoid a desktop environment since I only need to use the machine purely based only for "text" wise.
The machine will be used to display real time stock pricing and I would like to use color highlighting to make the text based real time charting terminal/console application more user friendly and readable.
I can not find any comprehensible or easy guide to do so and have no idea where to begin.
I am using ncurses to make the app.
When I type tput color
to the console, I get a return of a value 80
.
OP misuses the term "headless" for non-desktop, but the intent is clear from the reference to ncurses. This refers to text-mode in a FreeBSD console.
Short: you can't do that.
Longer: without X (desktop), unless you're going to develop a terminal emulator in which to run ncurses using 256-colors on FreeBSD, you're out of luck. See for instance
concol
(perhaps a starting point, but nothing that you could actually use with ncurses).Many users are misled by a FreeBSD developer's choice to set the
TERM
variable of the newer console terminal emulator to "xterm", supposing that it can display 256 colors. This is mentioned near the end of the XTerm FAQ "Can I set a color by its number", which goes into some detail explaining how the 256-color feature came about. There's a screenshot for teken (the proper name for the FreeBSD console emulator) which shows its inability to render 256-colors. Aside from changing the palette to shift it toward the red colors, it's unchanged since 2014.FreeBSD documentation refers to teken as "vt". Like the older "sc" (syscons), that only works for VGA colors (8 ANSI colors combined with bright/bold attribute to simulate 16 colors).
The FreeBSD console terminal emulator is documented in the ncurses terminal database section on the FreeBSD console emulators. In particular, there is a lengthy comment on this one before the
teken-2018
entry.Regarding this:
That is a misfeature of the FreeBSD configuration. Its system utility
tput
imitates the older termcap-based utility which (see the manual page) Keith Bostic wrote in 1989 imitating the AT&Ttput
utility. That's actually a few years too late to be regarded as "original termcap", but most users don't know the difference. Anyway, as a termcap utility (on the surface), only the first two characters of thatcolor
are used, givingco
(termcap equivalent forcolumns
). The termcap name forcolors
isCo
(see manual page):A termcap application would not understand the terminal descriptions used for colors in ncurses. This happens to sort-of work (for 16 colors) in the FreeBSD console because underneath the facade it is the terminfo-based ncurses library.
Some users are confused by the distinction between text and graphical VGA modes. A non-desktop environment uses text mode, which provides for 3 bits (8 text colors) combined with one bit which is often treated as bold, making 16 colors.
In a graphical mode, one can use a splash screen, with 256 colors. That is unrelated to text modes.
The
vidcontrol
program shows the available colors for the current video mode. It can list available modes as shown here. Only a few are usable for text (and all of those are as noted VGA):It can also show the colors with the caveat that different releases of FreeBSD have widely differing video capabilities. Here are screenshots from FreeBSD 11
FreeBSD 12
and FreeBSD 13 (where vidcontrol presents no choices):
Perhaps the lack of mode information from the FreeBSD 13 indicates that someone intends making it work with one of the graphic modes, as hinted in the manual page. But the color palette is not improved, yet. The manual page says for example
Further reading: