[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Different background color for different windows/modes
From: |
Alexandre Oberlin |
Subject: |
Re: Different background color for different windows/modes |
Date: |
Sun, 23 Jul 2017 06:53:33 -0700 (PDT) |
User-agent: |
G2/1.0 |
Hello,
Someone gave me a hint to do this in Emacs 24.4+ but I don't find the message
on gnu.emacs.help (Is this NG dying?).
The trick is to uses defface and face-remap-add-relative. It works very well,
including in GNU Emacs 24.5.1 (x86_64-unknown-cygwin) under Cygwin without X.
To modify the font and colors of your shell windows for instance, just add/load
the code below from your .emacs and add more attributes and more modes (text,
lisp, etc.) as desired.
The commented out entries are not necessary but may come handy when tweaking
your config.
Important: this code should be loaded before you visit/find any concerned file
or launch a shell from .emacs.
;;;;;;;;;;;;;;;;;;;;;;;; BEGIN .emacs CODE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; (face-spec-reset-face 'myshellface)
(defface myshellface
'((t :foreground "black"
:background "aquamarine"
:weight semi-bold
:underline nil
))
"Face for shells."
:group 'myfaces )
;; (face-spec-set
;; 'myshellface
;; '((t :foreground "black"
;; :background "aquamarine"
;; :weight semi-bold
;; :underline nil
;; ))
;; 'face-defface-spec
;; )
;; (facep 'myshellface)
;; (boundp 'myshellface)
;; (remove-hook 'shell-mode-hook
;; (lambda ()
;; (face-remap-add-relative 'default 'myshellface)))
(setq shell-mode-hook nil)
(add-hook 'shell-mode-hook
(lambda ()
(face-remap-add-relative 'default 'myshellface)))
;;;;;;;;;;;;;;;;;;;;;;;; END .emacs CODE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Cheers,
- Re: Different background color for different windows/modes,
Alexandre Oberlin <=