all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: oblique <psyberbits@gmail.com>
To: 14078@debbugs.gnu.org
Subject: bug#14078: [PATCH] Fix 256 color mapping in rxvt.el
Date: Thu, 28 Mar 2013 22:02:43 +0200	[thread overview]
Message-ID: <1364500963-3251-1-git-send-email-psyberbits@gmail.com> (raw)

Color mapping was wrong, I use the same way xterm.el does it.
---
 lisp/term/rxvt.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index 0e026a8..6a62cff 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,10 @@ 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)
-- 
1.8.1.5






             reply	other threads:[~2013-03-28 20:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-28 20:02 oblique [this message]
2013-12-17 16:04 ` bug#14078: [PATCH] Fix 256 color mapping in rxvt.el Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364500963-3251-1-git-send-email-psyberbits@gmail.com \
    --to=psyberbits@gmail.com \
    --cc=14078@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.