--- Begin Message ---
Subject: |
24.4.50; vc-annotate colors |
Date: |
Thu, 19 Jun 2014 09:54:44 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
Severity: wishlist
Tags: patch
Currently vc-annotate uses dark background even when the default background
is light. Would be nicer to have another option similar to the existing
`vc-annotate-background' that will define the default foreground
(instead of the default background) and put colors from color-map
on the background instead of the foreground:
=== modified file 'lisp/vc/vc-annotate.el'
--- lisp/vc/vc-annotate.el 2014-02-10 01:34:22 +0000
+++ lisp/vc/vc-annotate.el 2014-06-19 06:52:59 +0000
@@ -109,6 +109,16 @@ (defcustom vc-annotate-background "black
:type '(choice (const :tag "Default background" nil) (color))
:group 'vc)
+(defcustom vc-annotate-foreground nil
+ "Foreground color for \\[vc-annotate].
+When non-nil, the color range from `vc-annotate-color-map'
+is applied to background, and the color from this definition
+is applied to foreground.
+This option is in effect only when `vc-annotate-background' is nil."
+ :type '(choice (const :tag "Default foreground" nil) (color))
+ :version "24.5"
+ :group 'vc)
+
(defcustom vc-annotate-menu-elements '(2 0.5 0.1 0.01)
"Menu elements for the mode-specific menu of VC-Annotate mode.
List of factors, used to expand/compress the time scale. See `vc-annotate'."
@@ -347,7 +357,9 @@ (defun vc-annotate (file rev &optional d
`vc-annotate-menu-elements' customizes the menu elements of the
mode-specific menu. `vc-annotate-color-map' and
`vc-annotate-very-old-color' define the mapping of time to colors.
-`vc-annotate-background' specifies the background color."
+`vc-annotate-background' specifies the background color.
+`vc-annotate-foreground' specifies the foreground color
+when `vc-annotate-background' is nil."
(interactive
(save-current-buffer
(vc-ensure-vc-buffer)
@@ -666,10 +678,15 @@ (defun vc-annotate-lines (limit)
;; Make the face if not done.
(face (or (intern-soft face-name)
(let ((tmp-face (make-face (intern face-name))))
- (set-face-foreground tmp-face (cdr color))
- (when vc-annotate-background
- (set-face-background tmp-face
- vc-annotate-background))
+ (cond
+ (vc-annotate-background
+ (set-face-foreground tmp-face (cdr color))
+ (set-face-background tmp-face
vc-annotate-background))
+ (vc-annotate-foreground
+ (set-face-foreground tmp-face
vc-annotate-foreground)
+ (set-face-background tmp-face (cdr color)))
+ (t
+ (set-face-foreground tmp-face (cdr color))))
tmp-face)))) ; Return the face
(put-text-property start end 'face face)))))
;; Pretend to font-lock there were no matches.
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#17808: 24.4.50; vc-annotate colors |
Date: |
Tue, 08 Jul 2014 11:51:43 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) |
Version: 24.4.50
> To reduce saturation from 75% to 20% it was helpful to use
> the function `color-hsv-to-rgb' that I found in the list archives.
Installed in the trunk.
PS: this code shows how `color-hsv-to-rgb' could be used
to reduce saturation:
(pp
(mapcar
(lambda (pair)
(cons
(car pair)
(let ((hsv (apply 'color-rgb-to-hsv
(color-name-to-rgb
(cdr pair)))))
(apply 'color-rgb-to-hex
(color-hsv-to-rgb
(nth 0 hsv) 0.20 (nth 2 hsv))))))
'(( 20. . "#FF3F3F")
( 40. . "#FF6C3F")
( 60. . "#FF993F")
( 80. . "#FFC63F")
(100. . "#FFF33F")
(120. . "#DDFF3F")
(140. . "#B0FF3F")
(160. . "#83FF3F")
(180. . "#56FF3F")
(200. . "#3FFF56")
(220. . "#3FFF83")
(240. . "#3FFFB0")
(260. . "#3FFFDD")
(280. . "#3FF3FF")
(300. . "#3FC6FF")
(320. . "#3F99FF")
(340. . "#3F6CFF")
(360. . "#3F3FFF"))))
--- End Message ---