From: "Drew Adams" <drew.adams@oracle.com>
To: <4033@emacsbugs.donarmstrong.com>, "'Juri Linkov'" <juri@jurta.org>
Subject: bug#4033: 23.1; list-colors-display is misleading
Date: Tue, 4 Aug 2009 19:58:10 -0700 [thread overview]
Message-ID: <986CB10EE9314167B974BF1551275370@us.oracle.com> (raw)
In-Reply-To: <6875A66084B7406B8409F2C495A75D26@us.oracle.com>
> > > I have had at least one user state that he thought that, since the
> > > form shown is #RRGGBB, his colors had only that granularity. IOW,
> > > even if one's system allows colors of the form #RRRRGGGGBBBB (more
> > > colors), the color names are translated to hex strings of the form
> > > #RRGGBB (fewer colors).
> >
> > Could you show a formula that calculates the color granularity?
> >
> > We could use it to print colors in the short format #RRGGBB
> > for the smaller color space and #RRRRGGGGBBBB otherwise.
This seems to DTRT, for printing with an RGB format that reflects the color
support of the display:
(defun list-colors-print (list)
(let ((rgb-format (facemenu-rgb-format-for-display))
(col (car list))
rgb-width)
(when (consp col) (setq col (car col)))
(setq rgb-width (1+ (length (format rgb-format 1 1 1))))
(dolist (color list)
(if (consp color)
(when (cdr color)
(setq color (sort color (lambda (a b)
(string< (downcase a) (downcase b))))))
(setq color (list color)))
(put-text-property (prog1 (point)
(insert (car color)) (indent-to 22))
(point) 'face (list ':background (car color)))
(put-text-property (prog1 (point)
(insert " " (if (cdr color)
(mapconcat 'identity (cdr color) ",
")
(car color))))
(point) 'face (list ':foreground (car color)))
(indent-to (max (- (window-width) rgb-width) 44))
(insert (apply 'format rgb-format (mapcar (lambda (c) (lsh c -8))
(color-values (car color)))))
(insert "\n")))
(goto-char (point-min)))
The question remains whether this is a useful/reasonable thing to do.
next prev parent reply other threads:[~2009-08-05 2:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-04 16:01 bug#4033: 23.1; list-colors-display is misleading Drew Adams
2009-08-04 18:04 ` Eli Zaretskii
2009-08-04 18:48 ` Drew Adams
2009-08-04 19:40 ` Drew Adams
2009-08-04 19:45 ` Eli Zaretskii
2009-08-04 19:58 ` Drew Adams
2009-08-04 22:59 ` Jason Rumney
2009-08-04 23:29 ` Drew Adams
2009-08-04 23:42 ` Jason Rumney
2009-08-04 23:55 ` Drew Adams
2009-08-05 3:22 ` Eli Zaretskii
2009-08-05 5:34 ` Drew Adams
2009-08-05 6:57 ` Jason Rumney
2009-08-05 17:34 ` Eli Zaretskii
2009-08-04 23:27 ` Andreas Schwab
2009-08-04 21:35 ` Juri Linkov
2009-08-04 23:29 ` Drew Adams
2009-08-05 2:25 ` Drew Adams
2009-08-05 2:58 ` Drew Adams [this message]
2009-08-05 21:35 ` Juri Linkov
2009-08-05 23:16 ` Drew Adams
2009-08-05 2:36 ` Drew Adams
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=986CB10EE9314167B974BF1551275370@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=4033@emacsbugs.donarmstrong.com \
--cc=juri@jurta.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.