summaryrefslogtreecommitdiff
path: root/lisp/facemenu.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2012-09-30 19:36:42 +0300
committerJuri Linkov <juri@jurta.org>2012-09-30 19:36:42 +0300
commitd80d54b289a971d7a98dc5fafebaa957082c8222 (patch)
tree16e9835c084e67898a0b976ebfc86d9d4fe274ac /lisp/facemenu.el
parentc06c382ae494c4129da43f2c1ea0f72e39a45bf1 (diff)
downloademacs-d80d54b289a971d7a98dc5fafebaa957082c8222.tar.gz
* lisp/facemenu.el (list-colors-sort): Add option "Luminance".
(list-colors-sort-key): Implement it. * lisp/vc/diff-mode.el (diff-refine-removed): * lisp/vc/ediff-init.el (ediff-fine-diff-A): * lisp/vc/smerge-mode.el (smerge-refined-removed): Change background color "#ffaaaa" to "#ffbbbb". Fixes: debbugs:10181
Diffstat (limited to 'lisp/facemenu.el')
-rw-r--r--lisp/facemenu.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index bcef25eb893..88b9ddc7f54 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -464,7 +464,8 @@ These special properties include `invisible', `intangible' and `read-only'."
`(rgb-dist . COLOR)' sorts by the RGB distance to the specified color.
`hsv' sorts by hue, saturation, value.
`(hsv-dist . COLOR)' sorts by the HSV distance to the specified color
-and excludes grayscale colors."
+and excludes grayscale colors.
+`luminance' sorts by relative luminance in the CIE XYZ color space."
:type '(choice (const :tag "Unsorted" nil)
(const :tag "Color Name" name)
(const :tag "Red-Green-Blue" rgb)
@@ -474,7 +475,8 @@ and excludes grayscale colors."
(const :tag "Hue-Saturation-Value" hsv)
(cons :tag "Distance on HSV cylinder"
(const :tag "Distance from Color" hsv-dist)
- (color :tag "Source Color Name")))
+ (color :tag "Source Color Name"))
+ (const :tag "Luminance" luminance))
:group 'facemenu
:version "24.1")
@@ -504,7 +506,12 @@ filter out the color from the output."
(+ (expt (- 180 (abs (- 180 (abs (- (nth 0 c-hsv) ; wrap hue
(nth 0 o-hsv)))))) 2)
(expt (- (nth 1 c-hsv) (nth 1 o-hsv)) 2)
- (expt (- (nth 2 c-hsv) (nth 2 o-hsv)) 2)))))))
+ (expt (- (nth 2 c-hsv) (nth 2 o-hsv)) 2)))))
+ ((eq list-colors-sort 'luminance)
+ (let ((c-rgb (color-name-to-rgb color)))
+ (+ (* (nth 0 c-rgb) 0.21266729)
+ (* (nth 1 c-rgb) 0.7151522)
+ (* (nth 2 c-rgb) 0.0721750))))))
(defun list-colors-display (&optional list buffer-name callback)
"Display names of defined colors, and show what they look like.