aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2011-03-27 09:56:35 +0800
committerLeo Liu2011-03-27 09:56:35 +0800
commit7a097943f7d3433a5d053eee4b2f3254230fee64 (patch)
tree5113df84df000ef2eeef9ca094c527e9ff45a2cf
parentf2eefd24778eb8d577ea09a5c2d28b4df1471b8b (diff)
downloademacs-7a097943f7d3433a5d053eee4b2f3254230fee64.tar.gz
emacs-7a097943f7d3433a5d053eee4b2f3254230fee64.zip
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/ChangeLog6
-rw-r--r--lisp/ansi-color.el20
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 @@
12011-03-27 Leo Liu <sdl.web@gmail.com>
2
3 * ansi-color.el (ansi-color-names-vector): Allow cons cell value
4 for foreground and background colors.
5 (ansi-color-make-color-map): Adapt.
6
12011-03-25 Leo Liu <sdl.web@gmail.com> 72011-03-25 Leo Liu <sdl.web@gmail.com>
2 8
3 * midnight.el (midnight-time-float): Remove. Note it calculates 9 * 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
132 37 47 white 132 37 47 white
133 133
134This vector is used by `ansi-color-make-color-map' to create a color 134This vector is used by `ansi-color-make-color-map' to create a color
135map. This color map is stored in the variable `ansi-color-map'." 135map. This color map is stored in the variable `ansi-color-map'.
136 :type '(vector string string string string string string string string) 136
137Each element may also be a cons cell where the car and cdr specify the
138foreground and background colors, respectively."
139 :type '(vector (choice color (cons color color))
140 (choice color (cons color color))
141 (choice color (cons color color))
142 (choice color (cons color color))
143 (choice color (cons color color))
144 (choice color (cons color color))
145 (choice color (cons color color))
146 (choice color (cons color color)))
137 :set 'ansi-color-map-update 147 :set 'ansi-color-map-update
138 :initialize 'custom-initialize-default 148 :initialize 'custom-initialize-default
139 :group 'ansi-colors) 149 :group 'ansi-colors)
@@ -528,7 +538,8 @@ The face definitions are based upon the variables
528 (mapc 538 (mapc
529 (function (lambda (e) 539 (function (lambda (e)
530 (aset ansi-color-map index 540 (aset ansi-color-map index
531 (ansi-color-make-face 'foreground e)) 541 (ansi-color-make-face 'foreground
542 (if (consp e) (car e) e)))
532 (setq index (1+ index)) )) 543 (setq index (1+ index)) ))
533 ansi-color-names-vector) 544 ansi-color-names-vector)
534 ;; background attributes 545 ;; background attributes
@@ -536,7 +547,8 @@ The face definitions are based upon the variables
536 (mapc 547 (mapc
537 (function (lambda (e) 548 (function (lambda (e)
538 (aset ansi-color-map index 549 (aset ansi-color-map index
539 (ansi-color-make-face 'background e)) 550 (ansi-color-make-face 'background
551 (if (consp e) (cdr e) e)))
540 (setq index (1+ index)) )) 552 (setq index (1+ index)) ))
541 ansi-color-names-vector) 553 ansi-color-names-vector)
542 ansi-color-map)) 554 ansi-color-map))