[英]make emacs in a terminal use dark colors and not light font-lock colors
我在帶有終端的MacOS 10.6上使用emacs。 我有一個白色背景。
讀取引用的C ++字符串非常困難。 他們是淡綠色的。 關鍵詞是綠松石。
在搜索源代碼后,我瀏覽了cpp.el並確定我使用的是cpp-face-light-name-list而不是cpp-face-dark-name-list。
顯然這個函數應該根據背景顏色選擇正確的列表:
(defcustom cpp-face-default-list nil
"Alist of faces you can choose from for cpp conditionals.
Each element has the form (STRING . FACE), where STRING
serves as a name (for `cpp-highlight-buffer' only)
and FACE is either a face (a symbol)
or a cons cell (background-color . COLOR)."
:type '(repeat (cons string (choice face (cons (const background-color) string))))
:group 'cpp)
但它似乎沒有奏效。
我應該在我的.emacs文件中添加什么內容才能獲得cpp-face-dark-list而不是cpp-face-light-list?
謝謝!
我有同樣的問題,我選擇的主題在終端上總是不可讀的。 答案是使用顏色主題包,正如其他人所說,然后在終端中為Emacs選擇一個主題,並在自己的窗口中運行Emacs的另一個主題,如下所示:
(require 'color-theme)
(setq color-theme-is-global t)
(if window-system
(color-theme-deep-blue) ;; Emacs in own window
(color-theme-dark-laptop) ;; Emacs in tty
)
在Emacs中,您可以鍵入Mx color-theme-Tab
以獲取可用主題的列表。 同樣,您可以為主要模式添加鈎子,以根據您正在編輯的代碼類型更改顏色主題。
正如其中一條評論中所建議的那樣 - 查看顏色主題包。 對於像你這樣的問題來說,這是一個更通用的解決方案,它比手動調整字體更容易使用。
如果明確將default-face的前景設置為黑色,將background設置為白色( Mx customize-group basic-faces
),則字體鎖定將確保所有內容都可自動讀取。 如果您只需要足夠的對比度就可以讀取字體鎖,那么這兩種顏色是您需要設置的唯一顏色。
我已經嘗試過colortheme.el,特別是對於emacs23,它往往會減少而不是更具可讀性,我最終不得不重新啟動以恢復設置為不可讀的前景/背景組合並且沒有重置的面部。
可能值得確保您的終端啟用彩色: export TERM=xterm-256color
這是另一種方法,如果你在Emacs 23+中使用守護進程模式,它會特別方便。 在使用守護進程模式時,有時使用圖形客戶端,有時使用終端客戶端。 下面的“片段”試圖找出您正在使用的客戶端,然后切換到適當的主題(來自顏色主題選擇)。 在emacswiki上找到它。
(require 'color-theme)
(eval-after-load "color-theme"
(color-theme-initialize))
;; http://www.emacswiki.org/emacs/ColorTheme#toc10
;; select theme - first list element is for windowing system, second is for console/terminal
(setq color-theme-choices
'(color-theme-tangotango color-theme-standard))
(funcall (lambda (cols)
(let ((color-theme-is-global nil))
(eval
(append '(if (window-system))
(mapcar (lambda (x) (cons x nil))
cols)))))
color-theme-choices)
(require 'cl)
(fset 'test-win-sys
(funcall (lambda (cols)
(lexical-let ((cols cols))
(lambda (frame)
(let ((color-theme-is-global nil))
(select-frame frame)
(eval
(append '(if (window-system frame))
(mapcar (lambda (x) (cons x nil))
cols)))))))
color-theme-choices ))
(add-hook 'after-make-frame-functions 'test-win-sys)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.