Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the color of the characters in whitespace-mode [closed]

I have recently moved from Geany to Emacs and I would like to customize the whitespace characters in Emacs to look like the ones in Geany.

With Geany, the dots are tiny and grey:

Sample code with Geany

With Emacs, the dots are larger and white:

Sample code with Emacs

I find the dots in Geany much lighter on the eyes.

SOLUTION

The problem was solved after I commented (setq whitespace-style (quote (spaces tabs newline space-mark tab-mark newline-mark))) from my .emacs file:

;; make whitespace-mode use just basic coloring
;;(setq whitespace-style (quote (spaces tabs newline space-mark tab-mark newline-mark)))
(setq whitespace-display-mappings
  ;; all numbers are Unicode codepoint in decimal. ⁖ (insert-char 182 1)
  '(
    (space-mark 32 [183] [46]) ; 32 SPACE 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
    (newline-mark 10 [182 10]) ; 10 LINE FEED
    (tab-mark 9 [9655 9] [92 9]) ; 9 TAB, 9655 WHITE RIGHT-POINTING TRIANGLE 「▷」
    ))

The whitespace characters now look exactly as expected.

like image 868
Mathieu Avatar asked Apr 11 '13 10:04

Mathieu


1 Answers

Try M-x customize-face RET whitespace-space RET

(maybe start with a foreground colour of around gray30, and adjust from there.)

in elisp, something like:

(set-face-attribute 'whitespace-space nil :background nil :foreground "gray30")

(There might be a smaller dot than the one you're using, but I don't know what that would be offhand.)

like image 128
phils Avatar answered Oct 31 '22 01:10

phils