]> git.eshelyaron.com Git - emacs.git/commitdiff
(xterm-rgb-convert-to-16bit): Simplify.
authorDan Nicolaescu <dann@ics.uci.edu>
Sat, 9 Apr 2005 15:25:50 +0000 (15:25 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Sat, 9 Apr 2005 15:25:50 +0000 (15:25 +0000)
(xterm-register-default-colors): Update color values computation
to match xterm-200.

lisp/ChangeLog
lisp/term/xterm.el

index d569e9a016320c9f74ea3f4125bb87d4d4d38671..5f6731885d98c24e987d7eb7eee4b63d9a042199 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-09  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * term/xterm.el (xterm-rgb-convert-to-16bit): Simplify.
+       (xterm-register-default-colors): Update color values computation
+       to match xterm-200.
+
 2005-04-09  Kenichi Handa  <handa@m17n.org>
 
        * international/code-pages.el (iso-latin-7): Fix the map.
index 44688e82b6d3084ec1a47635c672dfb1321157c6..b62f6efd47886c1f6d5ca3e2984b2979909cff49 100644 (file)
 
 (defun xterm-rgb-convert-to-16bit (prim)
   "Convert an 8-bit primary color value PRIM to a corresponding 16-bit value."
-  (min 65535 (round (* (/ prim 255.0) 65535.0))))
+  (logior prim (lsh prim 8)))
 
 (defun xterm-register-default-colors ()
   "Register the default set of colors for xterm or compatible emulator.
@@ -160,9 +160,10 @@ versions of xterm."
            (tty-color-define (format "color-%d" (- 256 ncolors))
                              (- 256 ncolors)
                              (mapcar 'xterm-rgb-convert-to-16bit
-                                     (list (round (* r 42.5))
-                                           (round (* g 42.5))
-                                           (round (* b 42.5)))))
+                                     (list (if (zerop r) 0 (+ (* r 40) 55))
+                                           (if (zerop g) 0 (+ (* g 40) 55))
+                                           (if (zerop b) 0 (+ (* b 40) 55)))))
+
            (setq b (1+ b))
            (if (> b 5)
                (setq g (1+ g)
@@ -200,7 +201,7 @@ versions of xterm."
        ;; Now the 8 gray colors
        (while (> ncolors 0)
          (setq color (xterm-rgb-convert-to-16bit
-                      (round
+                      (floor
                        (if (= ncolors 8)
                            46.36363636
                          (+ (* (- 8 ncolors) 23.18181818) 69.54545454)))))