]> code.delx.au - gnu-emacs/commitdiff
* term/rxvt.el (rxvt-register-default-colors): Add support for 88
authorDan Nicolaescu <dann@ics.uci.edu>
Sat, 24 Sep 2005 23:10:02 +0000 (23:10 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Sat, 24 Sep 2005 23:10:02 +0000 (23:10 +0000)
colors rxvt-unicode terminals by using the same code as xterm.el.

lisp/ChangeLog
lisp/term/rxvt.el

index 3807037e57d56dc136e99fd7d18b0444537f9dc9..96091669512117c5cee7fc6a0735fd9d6825e27b 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-24  Emanuele Giaquinta <emanuele.giaquinta@gmail.com> (tiny change)
+
+       * term/rxvt.el (rxvt-register-default-colors): Add support for 88
+       colors rxvt-unicode terminals by using the same code as xterm.el.
+
 2005-09-24  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * textmodes/tex-mode.el (tex-font-lock-append-prop)
index 44a14271c920306b9512d69e25880377799f7609..05cd854f2248cd450927f9f51e7070bb0111e5e7 100644 (file)
@@ -210,6 +210,36 @@ for the currently selected frame."
       (setq colors (cdr colors)
            color (car colors)
            ncolors (1- ncolors)))
+    (when (and (> ncolors 0) (= ncolors 72))  ; rxvt-unicode
+      ;; 64 non-gray colors
+      (let ((levels '(0 139 205 255))
+           (r 0) (g 0) (b 0))
+       (while (> ncolors 8)
+         (tty-color-define (format "color-%d" (- 88 ncolors))
+                           (- 88 ncolors)
+                           (mapcar 'rxvt-rgb-convert-to-16bit
+                                   (list (nth r levels)
+                                         (nth g levels)
+                                         (nth b levels))))
+         (setq b (1+ b))
+         (if (> b 3)
+             (setq g (1+ g)
+                   b 0))
+         (if (> g 3)
+             (setq r (1+ r)
+                   g 0))
+         (setq ncolors (1- ncolors))))
+      ;; Now the 8 gray colors
+      (while (> ncolors 0)
+       (setq color (rxvt-rgb-convert-to-16bit
+                    (floor
+                     (if (= ncolors 8)
+                         46.36363636
+                       (+ (* (- 8 ncolors) 23.18181818) 69.54545454)))))
+       (tty-color-define (format "color-%d" (- 88 ncolors))
+                         (- 88 ncolors)
+                         (list color color color))
+       (setq ncolors (1- ncolors))))
     ;; Modifying color mappings means realized faces don't use the
     ;; right colors, so clear them.
     (clear-face-cache)))