[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4033: 23.1; list-colors-display is misleading
From: |
Drew Adams |
Subject: |
bug#4033: 23.1; list-colors-display is misleading |
Date: |
Tue, 4 Aug 2009 19:58:10 -0700 |
> > > 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.
- bug#4033: 23.1; list-colors-display is misleading, (continued)
- bug#4033: 23.1; list-colors-display is misleading, Drew Adams, 2009/08/04
- bug#4033: 23.1; list-colors-display is misleading, Eli Zaretskii, 2009/08/04
- bug#4033: 23.1; list-colors-display is misleading, Drew Adams, 2009/08/05
- bug#4033: 23.1; list-colors-display is misleading, Jason Rumney, 2009/08/05
- bug#4033: 23.1; list-colors-display is misleading, Eli Zaretskii, 2009/08/05
bug#4033: 23.1; list-colors-display is misleading, Andreas Schwab, 2009/08/04
bug#4033: 23.1; list-colors-display is misleading, Juri Linkov, 2009/08/04