diff options
| author | Leo Liu <sdl.web@gmail.com> | 2011-03-27 09:56:35 +0800 | 
|---|---|---|
| committer | Leo Liu <sdl.web@gmail.com> | 2011-03-27 09:56:35 +0800 | 
| commit | 7a097943f7d3433a5d053eee4b2f3254230fee64 (patch) | |
| tree | 5113df84df000ef2eeef9ca094c527e9ff45a2cf | |
| parent | f2eefd24778eb8d577ea09a5c2d28b4df1471b8b (diff) | |
| download | emacs-7a097943f7d3433a5d053eee4b2f3254230fee64.tar.gz | |
Support separate fg and bg colors in ansi-color.el
A color suitable for foreground text can make unreadable text if used
as background color, and vice versa.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/ansi-color.el | 20 | 
2 files changed, 22 insertions, 4 deletions
| diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f1b53619268..f6d06821062 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-03-27  Leo Liu  <sdl.web@gmail.com> + +	* ansi-color.el (ansi-color-names-vector): Allow cons cell value +	for foreground and background colors. +	(ansi-color-make-color-map): Adapt. +  2011-03-25  Leo Liu  <sdl.web@gmail.com>  	* midnight.el (midnight-time-float): Remove.  Note it calculates diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 2b43940c1bd..ff7edf40dcb 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -132,8 +132,18 @@ Parameter  Color    37  47   white  This vector is used by `ansi-color-make-color-map' to create a color -map.  This color map is stored in the variable `ansi-color-map'." -  :type '(vector string string string string string string string string) +map.  This color map is stored in the variable `ansi-color-map'. + +Each element may also be a cons cell where the car and cdr specify the +foreground and background colors, respectively." +  :type '(vector (choice color (cons color color)) +                 (choice color (cons color color)) +                 (choice color (cons color color)) +                 (choice color (cons color color)) +                 (choice color (cons color color)) +                 (choice color (cons color color)) +                 (choice color (cons color color)) +                 (choice color (cons color color)))    :set 'ansi-color-map-update    :initialize 'custom-initialize-default    :group 'ansi-colors) @@ -528,7 +538,8 @@ The face definitions are based upon the variables      (mapc       (function (lambda (e)                   (aset ansi-color-map index -		       (ansi-color-make-face 'foreground e)) +		       (ansi-color-make-face 'foreground +                                             (if (consp e) (car e) e)))                   (setq index (1+ index)) ))       ansi-color-names-vector)      ;; background attributes @@ -536,7 +547,8 @@ The face definitions are based upon the variables      (mapc       (function (lambda (e)                   (aset ansi-color-map index -		       (ansi-color-make-face 'background e)) +		       (ansi-color-make-face 'background +                                             (if (consp e) (cdr e) e)))                   (setq index (1+ index)) ))       ansi-color-names-vector)      ansi-color-map)) | 
