From: oblique Date: Tue, 17 Dec 2013 16:03:23 +0000 (+0800) Subject: Fix 256 color mapping in rxvt.el X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~368 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ed3af8a771c38048f075b81bc6c6fafa6dc5aff3;p=emacs.git Fix 256 color mapping in rxvt.el * term/rxvt.el (rxvt-rgb-convert-to-16bit): Standardize with xterm-rgb-convert-to-16bit. (rxvt-register-default-colors): Standardize with xterm-register-default-colors. Fixes: debbugs:14078 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8d67a12e3d6..a55cf9c180d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2013-12-17 oblique (tiny change) + + * term/rxvt.el (rxvt-rgb-convert-to-16bit): Standardize with + xterm-rgb-convert-to-16bit. + (rxvt-register-default-colors): Standardize with + xterm-register-default-colors (Bug#14078). + 2013-12-17 Dima Kogan (tiny change) * simple.el (kill-region): Pass mark first, then point, so that diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el index 0e026a8e4be..4dbbc12786c 100644 --- a/lisp/term/rxvt.el +++ b/lisp/term/rxvt.el @@ -201,7 +201,7 @@ (defun rxvt-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 rxvt-register-default-colors () "Register the default set of colors for rxvt or compatible emulator. @@ -233,9 +233,9 @@ for the currently selected frame." (tty-color-define (format "color-%d" (- 256 ncolors)) (- 256 ncolors) (mapcar 'rxvt-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)