From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#17808: 24.4.50; vc-annotate colors Date: Wed, 02 Jul 2014 02:18:27 +0300 Organization: JURTA Message-ID: <87vbrg8vvo.fsf@mail.jurta.org> References: <87bntpl77v.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1404260371 28582 80.91.229.3 (2 Jul 2014 00:19:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Jul 2014 00:19:31 +0000 (UTC) To: 17808@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 02 02:19:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1X28Gf-00086Q-Cl for geb-bug-gnu-emacs@m.gmane.org; Wed, 02 Jul 2014 02:19:21 +0200 Original-Received: from localhost ([::1]:50475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X28Ge-0004Ck-Ep for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Jul 2014 20:19:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X28GT-000488-NM for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 20:19:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X28GM-0001v5-6V for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 20:19:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X28GM-0001v1-2I for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 20:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X28GL-0004AX-LN for bug-gnu-emacs@gnu.org; Tue, 01 Jul 2014 20:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Jul 2014 00:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17808 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 17808-submit@debbugs.gnu.org id=B17808.140426030115928 (code B ref 17808); Wed, 02 Jul 2014 00:19:01 +0000 Original-Received: (at 17808) by debbugs.gnu.org; 2 Jul 2014 00:18:21 +0000 Original-Received: from localhost ([127.0.0.1]:39704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X28Ff-00048e-Q9 for submit@debbugs.gnu.org; Tue, 01 Jul 2014 20:18:21 -0400 Original-Received: from alc-vshost7.dreamhost.com ([69.163.216.107]:58344 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X28Fc-00048S-4B for 17808@debbugs.gnu.org; Tue, 01 Jul 2014 20:18:17 -0400 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.222.226]) by ps18281.dreamhostps.com (Postfix) with ESMTP id DE77B348328E39 for <17808@debbugs.gnu.org>; Tue, 1 Jul 2014 17:18:13 -0700 (PDT) In-Reply-To: <87bntpl77v.fsf@mail.jurta.org> (Juri Linkov's message of "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) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:91071 Archived-At: > 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: Actually much cleaner would be to add a dedicated user option that will define whether to apply the color map to the background or to the foreground. When applied to the background with the default light background, colors need to be less saturated, so the saturation is decreased from 75% to 20% for light backgrounds. Also `vc-annotate-background' doesn't need the default value "black" because the background will be dark on dark environments anyway. === 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-07-01 23:17:33 +0000 @@ -40,6 +40,22 @@ (defcustom vc-annotate-display-mode 'ful :value "20.5")) :group 'vc) +(defcustom vc-annotate-background-mode + (not (or (eq (or frame-background-mode + (frame-parameter nil 'background-mode)) 'dark) + (and (tty-display-color-p) (<= (display-color-cells) 8)))) + "Non-nil means `vc-annotate-color-map' is applied to the background. + +When non-nil, the color range from `vc-annotate-color-map' is applied +to the background, while the foreground remains default. + +When nil, the color range from `vc-annotate-color-map' is applied +to the foreground, and the color from the option `vc-annotate-background' +is applied to the background." + :type 'boolean + :version "24.5" + :group 'vc) + (defcustom vc-annotate-color-map (if (and (tty-display-color-p) (<= (display-color-cells) 8)) ;; A custom sorted TTY colormap @@ -71,25 +87,49 @@ (defcustom vc-annotate-color-map (prog1 (cons date x) (setq date (+ date delta)))) colors)) - ;; Normal colormap: hue stepped from 0-240deg, value=1., saturation=0.75 - '(( 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"))) + (cond + ;; Normal colormap for background colors with dark foreground: + ;; hue stepped from 0-240deg, value=1., saturation=0.20 + (vc-annotate-background-mode + '(( 20. . "#FFCCCC") + ( 40. . "#FFD8CC") + ( 60. . "#FFE4CC") + ( 80. . "#FFF0CC") + (100. . "#FFFCCC") + (120. . "#F6FFCC") + (140. . "#EAFFCC") + (160. . "#DEFFCC") + (180. . "#D2FFCC") + (200. . "#CCFFD2") + (220. . "#CCFFDE") + (240. . "#CCFFEA") + (260. . "#CCFFF6") + (280. . "#CCFCFF") + (300. . "#CCF0FF") + (320. . "#CCE4FF") + (340. . "#CCD8FF") + (360. . "#CCCCFF"))) + ;; Normal colormap for foreground colors on dark background: + ;; hue stepped from 0-240deg, value=1., saturation=0.75 + (t + '(( 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"))))) "Association list of age versus color, for \\[vc-annotate]. Ages are given in units of fractional days. Default is eighteen steps using a twenty day increment, from red to blue. For TTY @@ -98,12 +138,12 @@ (defcustom vc-annotate-color-map :type 'alist :group 'vc) -(defcustom vc-annotate-very-old-color "#3F3FFF" +(defcustom vc-annotate-very-old-color (if vc-annotate-background-mode "#CCCCFF" "#3F3FFF") "Color for lines older than the current color range in \\[vc-annotate]." :type 'string :group 'vc) -(defcustom vc-annotate-background "black" +(defcustom vc-annotate-background nil "Background color for \\[vc-annotate]. Default color is used if nil." :type '(choice (const :tag "Default background" nil) (color)) @@ -347,7 +387,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-background-mode' specifies whether the color map +should be applied to the background or foreground." (interactive (save-current-buffer (vc-ensure-vc-buffer) @@ -666,10 +708,13 @@ (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-mode + (set-face-background tmp-face (cdr color))) + (t + (set-face-foreground tmp-face (cdr color)) + (when vc-annotate-background + (set-face-background tmp-face vc-annotate-background)))) tmp-face)))) ; Return the face (put-text-property start end 'face face))))) ;; Pretend to font-lock there were no matches.