Skip to content

Instantly share code, notes, and snippets.

@knollet
Created August 24, 2023 08:34
Show Gist options
  • Save knollet/1631b150cd3f8edd0ea25b35912fda9f to your computer and use it in GitHub Desktop.
Save knollet/1631b150cd3f8edd0ea25b35912fda9f to your computer and use it in GitHub Desktop.

Emacs with 24 bits color in terminal

Troubleshooting

Recompile terminfo

Once the colors just stopped working, recompiling terminfo (see tic) worked for me. Perhaps there was an system wide update of terminfo and the format was changed somehow, so the old compiled files in my homedir didn't work anymore.

Terminals

Putty

Under settings->window->colours 'allow 24 bit colors'

environment variables

TERM=xterm-24bits
TERMINFO=$HOME/.terminfo/
COLORTERM=truecolor  # idk if this does anything.

tic

~/.terminfo/xterm-24bit.src

# Use colon separators.
xterm-24bit|xterm with 24-bit direct color mode,
  use=xterm-256color,
  setb24=\E[48:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm,
  setf24=\E[38:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm,
# Use semicolon separators.
xterm-24bits|xterm with 24-bit direct color mode,
  use=xterm-256color,
  setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
  setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,

compile

tic -o ~/.terminfo/ -x ~/.terminfo/xterm-24bit.src

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment