I am running emacs in xterm with 'emacs -nw'. When examining diffs I find it hard to read text typed in yellow foreground and green background. How do I change it to eg. green/black or green/default combination? Or is there simpler method to change color theme to something more suitable for xterm?
While @tarsius's answer gives the canonical answer, since the OP asks for a specific case and I have faced the same issue, I thought I share my resolution. I use the following face definitions to make the diffs more readable in magit.
(custom-set-faces ;; other faces '(magit-diff-added ((((type tty)) (:foreground "green")))) '(magit-diff-added-highlight ((((type tty)) (:foreground "LimeGreen")))) '(magit-diff-context-highlight ((((type tty)) (:foreground "default")))) '(magit-diff-file-heading ((((type tty)) nil))) '(magit-diff-removed ((((type tty)) (:foreground "red")))) '(magit-diff-removed-highlight ((((type tty)) (:foreground "IndianRed")))) '(magit-section-highlight ((((type tty)) nil))))
Besides choosing more suitable colours, I also made sure I do not lose the highlighting feature offered by magit. Please note though, these colours are most suitable when your terminal suports 256 colours (set
TERM=xterm-256color). Although quick testing tells me it is probably still okay with old 8 colour terminals. There is a caveat, I use a dark background, à la
xterm -rv, so all the colours are tuned for a dark background. Here is a screenshot:
M-x customize-group RET magit-faces RET to get a list of all the magit faces. All the faces whose names begin with
magit-diff- are relevant here, so you might have to change quite a few and it won't be easy to get a consistent result.
The manual has a whole node on the subject, but it isn't intended to give you some easy tricks that you could try. Instead it gives an introduction to the problem domain and mentions the relevant conventions and things to consider.
Then again, if you only do this for your own use, you can probably get away with just increasing the contrast in