0

I am using Emacs on my Raspberry Pi (an RPi Zero W and RPi 4) through an SSH connection with the Blink terminal program on my iPad.

Emacs seems to be limited to 256 colors, but the themes I am using (Dracula is one of them) support 24-bit color. The colors render correctly when using Emacs locally on my MacBook.

Is it possible to use Emacs with 24-bit color when connection to the Raspberry Pi over SSH?

Please let me know if there is any additional information I can provide to help clarify. Thank you!

2

I'm not familiar with "Blink" but presume this is not a limitation of that.

After logging in and before you start emacs try:

export TERM=xterm-256color
export COLORTERM=truecolor

The first one is necessary for the second one to work, which should set 24-bit (aka "true color") depth if possible.

I'm not an emacs user either; if this does not work check if the version on the Pi was compiled to use true color in terminal mode. Related to this point, I am an mc user, which can be compiled to support true color and usually is. Unfortunately, the version used in Raspbian/RpiOS (actually, I think Debian derived systems generally) uses an alternate TUI library (slang instead of ncurses) which only implements 256 colors.

4
  • Thanks. I’ve tried that with no luck. Any chance you have details on how to check for true color in terminal mode for the version I’m using, which is Raspberry Pi OS (32-bit) Lite? I downloaded from here: raspberrypi.org/downloads/raspberry-pi-os Jul 19 '20 at 15:54
  • 1
    If you are working via SSH the "terminal mode of the Raspberry Pi" is irrelevant (regardless of what you mean that to refer to). What's relevant are, 1) The client side SSH terminal application -- in this case, Blink, and 2) The remote application -- in this case, emacs. I've added a bit of trivia related to this last point above.
    – goldilocks
    Jul 19 '20 at 16:43
  • Thanks very much, this explains what’s going on. I guess a next step would be to advocate for true color support in Debian, though that seems unlikely to change much since there’s an alternate TUI library being used. Jul 19 '20 at 17:08
  • Sorry, that's the version of mc. The ncurses lib is there and most likely emacs does use it and should support true color. The simple way to test this would be via a screen and keyboard. You may need those two EXPORTs, but if it runs on the console (or in a GUI terminal) w/ true color then it should be able to do so via SSH.
    – goldilocks
    Jul 19 '20 at 17:24
1

I was able to get this working. After following the instructions from the Emacs FAQ, I found that I had to run export TERM=xterm-24bits (note the plural ‘bits’) and that enabled 24-bit color when running $ emacs.

If anyone is interested in getting 24-bit color to work over Mosh, you’ll need to build from scratch as described here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.