4

Background:

I use gnus under emacs -nw (so this question is about text-based usage, not the GUI). Depending on the value of the $TERM environment variable, gnus will, for example, highlight quoted text in articles, using different colors depending on the depth of quoting (the number of > characters at the beginning of each line).

I personally prefer plain black text on a white or light background. I usually run emacs -nw in a terminal emulator with color disabled; in that case it isn't an issue.

But for some ssh clients on mobile devices (particularly JuiceSSH on Android), there doesn't seem to be a way to disable color in the terminal emulator. And the default color scheme seems to assume I have a black background; since I use a white background, yellow text is essentially illegible.

One workaround I've found is to set $TERM to vt100, but that requires quitting and restarting emacs. (I run it under GNU screen, so I commonly view the same Emacs session on different terminal emulators.)

Finally, the question:

Is there a command or configuration option in emacs or in gnus to tell it not to use color highlighting without quitting and restarting either emacs or gnus? A global configuration for emacs would be ideal, but something specific to gnus would do nicely.

If that's not practical, a decent backup solution would be a straightforward way to use a color scheme that's legible on a white background.

Keith Thompson
  • 203
  • 1
  • 7
  • If you want no colors **always** I guess you could customize all the relevant faces. Probably a quite tedious chore. I guess it could be done programatically somehow... – asjo Jan 11 '16 at 21:06

2 Answers2

3

If all of the coloring is from font-lock-mode you can just turn off that mode.

You can also get the effect of removing all highlighting for a particular face by just customizing that face to be the same as face default (just inherit from face default and turn off all other face attributes besides inherit).

You can tell which face is used to highlight a given bit of text by putting the text cursor on that text and hitting C-u C-x =. The *Help* output tells you what faces are used at point (the cursor position).

Drew
  • 75,699
  • 9
  • 109
  • 225
  • `font-lock-mode` didn't help. As for "faces" I see multiple faces, including `gnus-header-name`, `gnus-header-from`, `gnus-header-subject`, `gnus-cite-1`, `gnus-cite-2`. I'm hoping for a single command that will disable all of them. If that's not possible, it would help to know *how* to customize a face (a reference to the documentation would probably suffice for that). – Keith Thompson Jan 11 '16 at 21:19
  • `M-x customize-face`. You can find it in the Emacs manual (`C-h r`), by using `i` to search the index. Pretty simple to find. – Drew Jan 11 '16 at 21:30
2

Make a list of all the faces that are causing trouble (M-x list-faces-display is helpful). Wipe out the foreground/background attributes of those faces:

(cl-loop for face in '(gnus-header-name gnus-header-from gnus-header-subject …) do
     (set-face-attribute face nil :foreground nil :background nil))

If you want to wipe out the color from all faces, not only the gnus ones:

(cl-loop for face in (face-list) do
     (set-face-attribute face nil :foreground nil :background nil))
amitp
  • 2,451
  • 12
  • 23
  • I ran into two problems with this, as described in the following questions: (1) https://emacs.stackexchange.com/questions/55706/symbols-function-definition-is-void-cl-loop (2) https://emacs.stackexchange.com/questions/55715/disable-coloring-of-text-in-operations-in-emacs-nw-during-operations-like-sear –  Feb 23 '20 at 01:53