Is there a way to have more than 16 colors on the frame buffer console?

Subject says it all. It is my understanding that the frame buffer console that I get with a loader.conf entry of "efi_max_resolution=4k" supports only 16 colors.
I can set all 16 of kern.vt.color.{0..15}.rgb="#rrggbb" and select from the full 8bpp palette. If I print a 6x6x6 color cube, only 16 colors are used.
Is there a way to set more colors? I'd be happy with 256, like in a color-xterm.
 
What does env say?

Mine says:
TERM=xterm-256color
Mine has TERM=xterm
Setting it to xterm-256color does not change the 6x6x6 color cube result. Do you have 256 colors on the console?

This is my colortest.sh script:
sh:
#!/bin/sh
#
# colortest256.sh - output a color test page

clear=$(printf "\033[m")
bg=$(printf "\033[48;5;")
fg=$(printf "\033[38;5;")
bd=$(printf "\033[1m")

printf "The 16 ${bd}system colors:$clear\n"
for color in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
  printf "$bg${color}m$fg%dm%3d" $((color % 4 ? 0 : 15)) $color
  test $color = 7 && printf "$clear${fg}0m\n"
done
printf "$clear\n\n"

printf "The 6x6x6 color cube:\n"
for g in 0 1 2 3 4 5; do
  for r in 0 1 2; do
    for b in 0 1 2 3 4 5; do
      : $((color = 16 + r * 36 + g * 6 + b))
      printf "$bg${color}m$fg%dm%3d$clear" $((g > 2 ? 0 : 15)) $color
      test $b -lt 5 && printf ' '
    done
    printf "$clear"
    test $r -lt 2 && printf '|'
  done
  printf "\n"
done
printf '%s\n' "-----------------------+-----------------------+-----------------------"

for g in 0 1 2 3 4 5; do
  for r in 3 4 5; do
    for b in 0 1 2 3 4 5; do
      : $((color = 16 + r * 36 + g * 6 + b))
      printf "$bg${color}m$fg%dm%3d$clear" $((g > 2 ? 0 : 15)) $color
      test $b -lt 5 && printf ' '
    done
    test $r -lt 5 && printf '|'
    printf "$clear"
  done
  printf "\n"
done
printf "\n"

printf "The neutral step wedge:\n";
for color in 232 233 234 235 236 237 238 239 240 241 242 243; do
  printf "$bg${color}m${fg}15m%4d" $color
done
printf "$clear\n"
for color in 244 245 246 247 248 249 250 251 252 253 254 255; do
  printf "$bg${color}m${fg}0m%4d" $color
done
printf "$clear\n"
exit
 
I know it works in X11. Why has the console only 4 bits per pixel? If I look at the code in /usr/src/sys/dev/vt/hw/fb/vt_fb.c there's this function which checks for much larger BPP values:

C:
  static int
  vt_fb_init_colors(struct fb_info *info)
  {

      switch (FBTYPE_GET_BPP(info)) {
      case 8:
          return (vt_config_cons_colors(info, COLOR_FORMAT_RGB,
              0x7, 5, 0x7, 2, 0x3, 0));
      case 15:
          return (vt_config_cons_colors(info, COLOR_FORMAT_RGB,
              0x1f, 10, 0x1f, 5, 0x1f, 0));
      case 16:
          return (vt_config_cons_colors(info, COLOR_FORMAT_RGB,
              0x1f, 11, 0x3f, 5, 0x1f, 0));
      case 24:
      case 32: /* Ignore alpha. */
          return (vt_config_cons_colors(info, COLOR_FORMAT_RGB,
              0xff, 16, 0xff, 8, 0xff, 0));
      default:
          return (1);
      }
  }

This suggests to me there could be a way to have more colors but I have not yet found it...
 
Back
Top