emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103759: Support separate fg and bg c


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103759: Support separate fg and bg colors in ansi-color.el
Date: Sun, 27 Mar 2011 09:56:35 +0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103759
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Sun 2011-03-27 09:56:35 +0800
message:
  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.
modified:
  lisp/ChangeLog
  lisp/ansi-color.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-25 22:26:30 +0000
+++ b/lisp/ChangeLog    2011-03-27 01:56:35 +0000
@@ -1,3 +1,9 @@
+2011-03-27  Leo Liu  <address@hidden>
+
+       * 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  <address@hidden>
 
        * midnight.el (midnight-time-float): Remove.  Note it calculates

=== modified file 'lisp/ansi-color.el'
--- a/lisp/ansi-color.el        2011-01-25 04:08:28 +0000
+++ b/lisp/ansi-color.el        2011-03-27 01:56:35 +0000
@@ -132,8 +132,18 @@
   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 @@
     (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 @@
     (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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]