2010-08-05 23 views
11

W Emacs używam schematu kolorów z ciemnym tłem i jasnym tekstem. Podczas pracy z plikami .rst, mam tryb dla tego, który używa rst.el. Jednak rst.el podkreśla nagłówki o jasnym kolorze tła, co uniemożliwia odczytanie jasnego tekstu!Modyfikowanie kolorów w rst.el

myślę, że jest to fragment kodu w rst.el który jest odpowiedzialny za kolorami tła:

(defgroup rst-faces-defaults nil 
    "Values used to generate default faces for section titles on all levels. 
Tweak these if you are content with how section title faces are built in 
general but you do not like the details." 
    :group 'rst-faces 
    :version "21.1") 

(defun rst-define-level-faces() 
    "Define the faces for the section title text faces from the values." 
    ;; All variables used here must be checked in `rst-set-level-default' 
    (let ((i 1)) 
    (while (<= i rst-level-face-max) 
     (let ((sym (intern (format "rst-level-%d-face" i))) 
     (doc (format "Face for showing section title text at level %d" i)) 
     (col (format ("gray10"))) 
    (make-empty-face sym) 
    (set-face-doc-string sym doc) 
    (set-face-background sym col) 
    (set sym sym) 
    (setq i (1+ i)))))) 

(defun rst-set-level-default (sym val) 
    "Set a customized value affecting section title text face and recompute the 
faces." 
    (custom-set-default sym val) 
    ;; Also defines the faces initially when all values are available 
    (and (boundp 'rst-level-face-max) 
     (boundp 'rst-level-face-format-light) 
     (boundp 'rst-level-face-base-color) 
     (boundp 'rst-level-face-step-light) 
     (boundp 'rst-level-face-base-light) 
     (rst-define-level-faces))) 

;; Faces for displaying items on several levels; these definitions define 
;; different shades of grey where the lightest one (i.e. least contrasting) is 
;; used for level 1 
(defcustom rst-level-face-max 6 
    "Maximum depth of levels for which section title faces are defined." 
    :group 'rst-faces-defaults 
    :type '(integer) 
    :set 'rst-set-level-default) 
(defcustom rst-level-face-base-color "grey" 
    "The base name of the color to be used for creating background colors in 
ection title faces for all levels." 
    :group 'rst-faces-defaults 
    :type '(string) 
    :set 'rst-set-level-default) 
(defcustom rst-level-face-base-light 
    (if (eq frame-background-mode 'dark) 
     85 
    15) 
    "The lightness factor for the base color. This value is used for level 1. The 
default depends on whether the value of `frame-background-mode' is `dark' or 
not." 
    :group 'rst-faces-defaults 
    :type '(integer) 
    :set 'rst-set-level-default) 
(defcustom rst-level-face-format-light "%2d" 
    "The format for the lightness factor appended to the base name of the color. 
This value is expanded by `format' with an integer." 
    :group 'rst-faces-defaults 
    :type '(string) 
    :set 'rst-set-level-default) 
(defcustom rst-level-face-step-light 
    (if (eq frame-background-mode 'dark) 
    -7 
    7) 
    "The step width to use for the next color. The formula 

    `rst-level-face-base-light' 
    + (`rst-level-face-max' - 1) * `rst-level-face-step-light' 

must result in a color level which appended to `rst-level-face-base-color' 
using `rst-level-face-format-light' results in a valid color such as `grey50'. 
This color is used as background for section title text on level 
`rst-level-face-max'." 
    :group 'rst-faces-defaults 
    :type '(integer) 
    :set 'rst-set-level-default) 

(defcustom rst-adornment-faces-alist 
    (let ((alist '((t . font-lock-keyword-face) 
     (nil . font-lock-keyword-face))) 
    (i 1)) 
    (while (<= i rst-level-face-max) 
     (nconc alist (list (cons i (intern (format "rst-level-%d-face" i))))) 
     (setq i (1+ i))) 
    alist) 
    "Provides faces for the various adornment types. Key is a number (for the 
section title text of that level), t (for transitions) or nil (for section 
title adornment). If you generally do not like how section title text faces are 
set up tweak here. If the general idea is ok for you but you do not like the 
details check the Rst Faces Defaults group." 
    :group 'rst-faces 
    :type '(alist 
     :key-type 
     (choice 
     (integer 
     :tag 
     "Section level (may not be bigger than `rst-level-face-max')") 
     (boolean :tag "transitions (on)/section title adornment (off)")) 
     :value-type (face)) 
    :set-after '(rst-level-face-max)) 

Próbowałem zmieniając „szary” na coś innego, ale to nie zmienia rzecz. Jakaś pomoc?

Odpowiedz

5
M-x customize-group rst-faces 

Jeśli upierasz się przy użyciu kodu, a następnie użyć dostosować ustawić kilka rzeczy, spojrzeć na wygenerowanego kodu i użyć go jako model. Jednak nie jest już uważane za dobrą formę, aby to zrobić przy użyciu staromodnego kodu .emacs.

+0

Dla osób nieświadomych łatwego dostosowywania w emacs: Następnie naciśnij enter na prawej zmiennej 'Hide Rst Level 1'. Zostanie wyświetlona lista ustawień i zmienić tło, zawsze naciskając enter w prawym polu. – user989762

4

Korzystanie

M-x customize-group rst-faces-default 

i ustawić wartość Rst Level Face Base Color do black zrobić tytuły łatwiejsze do odczytania. Upewnij się, że ustawiłeś wartość dla wszystkich przyszłych sesji.

6

Przepraszam za wykopanie starego pytania.

Pole do zmiany to Rst Level Face Base Light. Zmiana wartości na ~ 51 z wartości domyślnej 85 powoduje, że tekst jest czytelny, ale utrzymuje podświetlanie tytułów.

Wykorzystuje on systematycznie nazwane kolory grey%2d, aby zacieniać głębokość przekroju opartego na tle.

+0

Ja osobiście wolę ciemniejszy odcień szarości dla lepszego kontrastu, dlatego ustawiam "Podstawowy poziom światła twarzy" na "25". ** Uwaga **: Musiałem zrestartować Emacsa, aby zmiana weszła w życie, więc nie jestem pewien, czy jest to zawsze konieczne, czy jest to coś konkretnego z mojej wersji. –