10

I just ran into a weird issue while tweaking my colour theme for terminal Emacs. The background wasn't appearing as black as expected, but grey, even though the background was set to #000000. So I opened the 'customize-face' dialog, and then opened the 'choose colour' option for background. This presents the following list:

enter image description here

Notice that the first colour, black, is actually grey, despite being listed as #000000. Stranger, is there is a second colour named color-16, with the same code #000000, and it is full black (see the bottom of the image).

The upshot is if I set a colour to #000000 or black, I actually get grey, but if I set the colour to color-16, I get black.

This doesn't happen in GUI Emacs, where #000000 is called black, and produces true black. There is no color-16 in my GUI emacs.

This is a bit awkward as I'd like to have the same color theme for GUI and terminal emacs, but black seems to mean different things. Can anyone explain this?

Emacs 27.0.50
Debian Linux
gnome terminal

2
  • 4
    It's just a problem with the color scheme of your terminal. I don't know what terminal you're using, but I assume it's just one of these 256 color terminals. Try tweaking the color scheme so colors match your expectations.
    – user12563
    Commented Oct 17, 2017 at 14:52
  • I see. I'm using gnome-terminal, and the problem disappears in xterm (which only has 8 colors). I'll look into how gnome terminal sets its colors.
    – Tyler
    Commented Oct 17, 2017 at 14:59

2 Answers 2

13

Turns out this was a problem with gnome-terminal. I fixed it by opening the profile preferences from the gnome-terminal menu bar, selecting colours, and changing the built-in scheme to Linux console.

0
2

color-16 don't work in emacs gui. I use this configuration:

(load-theme 'dark-laptop t)
(if (not (display-graphic-p))
    (set-face-background 'default "color-16"))

But it's not a good solution. With 16 colors terminal (terminator + telnet + tmux) I have lots of Unable to load color "color-16".

Bellow screenhot of my terminal before setting background to color-16. Reading is tiring after a while, especially on large terminals.

without setting background to color-16, black is gray

Second screenhot is with background set to color-16.

background set to color-16

1
  • This does not seem to answer the question. It's more of an extended comment (on a possibly different problem).
    – NickD
    Commented Jun 6, 2021 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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