{"thread":{"id":"25708","subject":"[PATCH 0/3] gitk: improve dark background","startedAt":"2010-11-11T04:59:54Z","lastAt":"2010-11-27T01:34:35Z","messageCount":6,"participants":["David Fries","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"155647","messageId":"1289451597-6950-1-git-send-email-david@fries.net","threadId":"25708","inReplyTo":null,"subject":"[PATCH 0/3] gitk: improve dark background","fromName":"David Fries","fromEmail":"david@fries.net","sentAt":"2010-11-11T04:59:54Z","receivedAt":"2010-11-11T04:59:54Z","isPatch":true,"sender":{"key":"david@fries.net","avatar":"https://avatars.githubusercontent.com/u/2767875?v=4"},"body":"The gitk preferences allow for the user to select different colors.\nThe setui is even set to dynamically detect how light or dark the\nbackground is and set the selection color to be the opposite, but\nthere are a few other color selections that don't currently work with\na dark background such as the black outlines.  This patch improves the\ncolor selection.  In some cases it just needs to use the current\nforground color, other places it is more complicated.\n\nThe gitk_colors branch can be pulled from,\ngit://gitorious.org/~dfries/git/dfriess-git-mainline.git\n\nmy relevant .gitk config file settings,\n\nset mainfont {Helvetica 8}\nset textfont {Courier 8}\nset uifont {Helvetica 9 bold}\nset uicolor grey85\nset bgcolor black\nset fgcolor white\nset colors {green red blue magenta darkgrey brown orange}\nset diffcolors {red green cyan}\nset markbgcolor #404060\nset selectbgcolor gray50\n"},{"id":"155648","messageId":"1289452742-7235-1-git-send-email-david@fries.net","threadId":"25708","inReplyTo":"1289451597-6950-1-git-send-email-david@fries.net","subject":"[PATCH 1/3] gitk: improve dark background, s/black/$fgcolor/","fromName":"David Fries","fromEmail":"david@fries.net","sentAt":"2010-11-11T05:19:00Z","receivedAt":"2010-11-11T05:19:00Z","isPatch":true,"sender":{"key":"david@fries.net","avatar":"https://avatars.githubusercontent.com/u/2767875?v=4"},"body":"Replace most uses of black with $fgcolor as items such as a black\noutline on the tag or tag lines with a black background doesn't show\nup.  Use $fgcolor instead to make it contrast with the background.\n\nSigned-off-by: David Fries <David@Fries.net>\n---\n gitk-git/gitk |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 1b0e09a..af43353 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -6270,7 +6270,7 @@ proc drawtags {id x xt y1} {\n \tset xt [expr {$xt + $delta + $wid + $lthickness + $linespc}]\n     }\n     set t [$canv create line $x $y1 [lindex $xvals end] $y1 \\\n-\t       -width $lthickness -fill black -tags tag.$id]\n+\t       -width $lthickness -fill $fgcolor -tags [list tag.$id line]]\n     $canv lower $t\n     foreach tag $marks x $xvals wid $wvals {\n \tset xl [expr {$x + $delta}]\n@@ -6280,7 +6280,7 @@ proc drawtags {id x xt y1} {\n \t    # draw a tag\n \t    set t [$canv create polygon $x [expr {$yt + $delta}] $xl $yt \\\n \t\t       $xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta}] \\\n-\t\t       -width 1 -outline black -fill yellow -tags tag.$id]\n+\t\t       -width 1 -outline $fgcolor -fill yellow -tags tag.$id]\n \t    $canv bind $t <1> [list showtag $tag 1]\n \t    set rowtextx([rowofcommit $id]) [expr {$xr + $linespc}]\n \t} else {\n@@ -6295,7 +6295,7 @@ proc drawtags {id x xt y1} {\n \t    }\n \t    set xl [expr {$xl - $delta/2}]\n \t    $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \\\n-\t\t-width 1 -outline black -fill $col -tags tag.$id\n+\t\t-width 1 -outline $fgcolor -fill $col -tags tag.$id\n \t    if {[regexp {^(remotes/.*/|remotes/)} $tag match remoteprefix]} {\n \t        set rwid [font measure mainfont $remoteprefix]\n \t\tset xi [expr {$x + 1}]\n@@ -8215,6 +8215,7 @@ proc linehover {} {\n     global hoverx hovery hoverid hovertimer\n     global canv linespc lthickness\n     global commitinfo\n+    global fgcolor\n \n     set text [lindex $commitinfo($hoverid) 0]\n     set ymax [lindex [$canv cget -scrollregion] 3]\n@@ -8227,7 +8228,7 @@ proc linehover {} {\n     set x1 [expr {$x + [font measure mainfont $text] + 2 * $lthickness}]\n     set y1 [expr {$y + $linespc + 2 * $lthickness}]\n     set t [$canv create rectangle $x0 $y0 $x1 $y1 \\\n-\t       -fill \\#ffff80 -outline black -width 1 -tags hover]\n+\t       -fill \\#ffff80 -outline $fgcolor -width 1 -tags hover]\n     $canv raise $t\n     set t [$canv create text $x $y -anchor nw -text $text -tags hover \\\n \t       -font mainfont]\n@@ -10886,6 +10887,7 @@ proc setfg {c} {\n     allcanvs itemconf text -fill $c\n     $canv itemconf circle -outline $c\n     $canv itemconf markid -outline $c\n+    $canv itemconf line -fill $c\n }\n \n proc prefscan {} {\n-- \n1.7.2.3\n"},{"id":"155650","messageId":"1289452742-7235-2-git-send-email-david@fries.net","threadId":"25708","inReplyTo":"1289451597-6950-1-git-send-email-david@fries.net","subject":"[PATCH 2/3] gitk: improve dark background, use diffcolor 2 for link","fromName":"David Fries","fromEmail":"david@fries.net","sentAt":"2010-11-11T05:19:01Z","receivedAt":"2010-11-11T05:19:01Z","isPatch":true,"sender":{"key":"david@fries.net","avatar":"https://avatars.githubusercontent.com/u/2767875?v=4"},"body":"blue on a black background might as well look like dark blue on black\nand is very difficult to read.  The \"Diff: hunk header\" keeps the\ncolors more consistent and both default to blue.\n\nSigned-off-by: David Fries <David@Fries.net>\n---\n gitk-git/gitk |   20 ++++++++++++++++----\n 1 files changed, 16 insertions(+), 4 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex af43353..bef2e53 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -6673,7 +6673,7 @@ proc appendwithlinks {text tags} {\n }\n \n proc setlink {id lk} {\n-    global curview ctext pendinglinks\n+    global curview ctext pendinglinks diffcolors\n \n     set known 0\n     if {[string length $id] < 40} {\n@@ -6687,7 +6687,7 @@ proc setlink {id lk} {\n \tset known [commitinview $id $curview]\n     }\n     if {$known} {\n-\t$ctext tag conf $lk -foreground blue -underline 1\n+\t$ctext tag conf $lk -foreground [lindex $diffcolors 2] -underline 1\n \t$ctext tag bind $lk <1> [list selbyid $id]\n \t$ctext tag bind $lk <Enter> {linkcursor %W 1}\n \t$ctext tag bind $lk <Leave> {linkcursor %W -1}\n@@ -10792,8 +10792,7 @@ proc doprefs {} {\n     label $top.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]\n     ${NS}::button $top.hunksepbut -text [mc \"Diff: hunk header\"] \\\n \t-command [list choosecolor diffcolors 2 $top.hunksep \\\n-\t\t      [mc \"diff hunk header\"] \\\n-\t\t      [list $ctext tag conf hunksep -foreground]]\n+\t\t      [mc \"diff hunk header\"] sethunksep ]\n     grid x $top.hunksepbut $top.hunksep -sticky w\n     label $top.markbgsep -padx 40 -relief sunk -background $markbgcolor\n     ${NS}::button $top.markbgbut -text [mc \"Marked line bg\"] \\\n@@ -10890,6 +10889,19 @@ proc setfg {c} {\n     $canv itemconf line -fill $c\n }\n \n+# update hunksep and each link foreground color\n+proc sethunksep {c} {\n+    global ctext linknum\n+\n+    $ctext tag conf hunksep -foreground $c\n+    for {set i 0} {$i < $linknum} {incr i} {\n+        # Use -underline to determine if it is a known link and gets this color\n+        if {[$ctext tag cget link$i -underline] != \"\"} {\n+            $ctext tag conf link$i -foreground $c\n+        }\n+    }\n+}\n+\n proc prefscan {} {\n     global oldprefs prefstop\n \n-- \n1.7.2.3\n"},{"id":"155649","messageId":"1289452742-7235-3-git-send-email-david@fries.net","threadId":"25708","inReplyTo":"1289451597-6950-1-git-send-email-david@fries.net","subject":"[PATCH 3/3] gitk: improve dark background, select light or dark tags","fromName":"David Fries","fromEmail":"david@fries.net","sentAt":"2010-11-11T05:19:02Z","receivedAt":"2010-11-11T05:19:02Z","isPatch":true,"sender":{"key":"david@fries.net","avatar":"https://avatars.githubusercontent.com/u/2767875?v=4"},"body":"If the foreground color is dark use light tags, branches, and\nremote fill colors.  If it is light use darker versions so the\ntext is readable.\n\nSigned-off-by: David Fries <David@Fries.net>\n---\n gitk-git/gitk |   41 +++++++++++++++++++++++++++++++++++++----\n 1 files changed, 37 insertions(+), 4 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex bef2e53..6342a31 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -6233,6 +6233,7 @@ proc drawtags {id x xt y1} {\n     global idtags idheads idotherrefs mainhead\n     global linespc lthickness\n     global canv rowtextx curview fgcolor bgcolor ctxbut\n+    global tagcolor branchcolor remotecolor\n \n     set marks {}\n     set ntags 0\n@@ -6280,29 +6281,32 @@ proc drawtags {id x xt y1} {\n \t    # draw a tag\n \t    set t [$canv create polygon $x [expr {$yt + $delta}] $xl $yt \\\n \t\t       $xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta}] \\\n-\t\t       -width 1 -outline $fgcolor -fill yellow -tags tag.$id]\n+\t\t       -width 1 -outline $fgcolor -fill $tagcolor -tags \\\n+\t\t       [list tag.$id tagcolor]]\n \t    $canv bind $t <1> [list showtag $tag 1]\n \t    set rowtextx([rowofcommit $id]) [expr {$xr + $linespc}]\n \t} else {\n \t    # draw a head or other ref\n \t    if {[incr nheads -1] >= 0} {\n-\t\tset col green\n+\t\tset col $branchcolor\n+\t\tset t [list tag.$id branchcolor]\n \t\tif {$tag eq $mainhead} {\n \t\t    set font mainfontbold\n \t\t}\n \t    } else {\n \t\tset col \"#ddddff\"\n+\t\tset t tag.$id\n \t    }\n \t    set xl [expr {$xl - $delta/2}]\n \t    $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \\\n-\t\t-width 1 -outline $fgcolor -fill $col -tags tag.$id\n+\t\t-width 1 -outline $fgcolor -fill $col -tags $t\n \t    if {[regexp {^(remotes/.*/|remotes/)} $tag match remoteprefix]} {\n \t        set rwid [font measure mainfont $remoteprefix]\n \t\tset xi [expr {$x + 1}]\n \t\tset yti [expr {$yt + 1}]\n \t\tset xri [expr {$x + $rwid}]\n \t\t$canv create polygon $xi $yti $xri $yti $xri $yb $xi $yb \\\n-\t\t\t-width 0 -fill \"#ffddaa\" -tags tag.$id\n+\t\t\t-width 0 -fill $remotecolor -tags [list tag.$id remotecolor]\n \t    }\n \t}\n \tset t [$canv create text $xl $y1 -anchor w -text $tag -fill $fgcolor \\\n@@ -10877,6 +10881,30 @@ proc setbg {c} {\n     }\n }\n \n+proc setfill {c} {\n+    global tagcolor branchcolor remotecolor\n+    global canv;\n+\n+    set fg [winfo rgb . $c]\n+    if {[lindex $fg 0] + 1.5 * [lindex $fg 1] + 0.5 * [lindex $fg 2] > 100000} {\n+\t# dark fill to read a light foreground font\n+\tset tagcolor yellow4\n+\tset branchcolor green4\n+\tset remotecolor \"#806F55\"\n+    } else {\n+\t# light fill to read a dark foreground font\n+        set tagcolor yellow\n+        set branchcolor green\n+        set remotecolor \"#ffddaa\"\n+    }\n+    # update tags assocated with non-text elements\n+    if {[info exists canv]} {\n+        $canv itemconf tagcolor -fill $tagcolor\n+        $canv itemconf branchcolor -fill $branchcolor\n+        $canv itemconf remotecolor -fill $remotecolor\n+    }\n+}\n+\n proc setfg {c} {\n     global fglist canv\n \n@@ -10887,6 +10915,10 @@ proc setfg {c} {\n     $canv itemconf circle -outline $c\n     $canv itemconf markid -outline $c\n     $canv itemconf line -fill $c\n+    $canv itemconf tagcolor -outline $c\n+    $canv itemconf branchcolor -outline $c\n+\n+    setfill $c\n }\n \n # update hunksep and each link foreground color\n@@ -11436,6 +11468,7 @@ namespace import ::msgcat::mc\n ::msgcat::mcload $gitk_msgsdir\n \n catch {source ~/.gitk}\n+setfill $fgcolor\n \n parsefont mainfont $mainfont\n eval font create mainfont [fontflags mainfont]\n-- \n1.7.2.3\n"},{"id":"156697","messageId":"20101126224136.GA26477@spacedout.fries.net","threadId":"25708","inReplyTo":"1289451597-6950-1-git-send-email-david@fries.net","subject":"[PATCH 0/3] gitk: improve dark background","fromName":"David Fries","fromEmail":"david@fries.net","sentAt":"2010-11-26T22:41:36Z","receivedAt":"2010-11-26T22:41:36Z","isPatch":true,"sender":{"key":"david@fries.net","avatar":"https://avatars.githubusercontent.com/u/2767875?v=4"},"body":"Junio,\n\nI submitted the 'gitk: improve dark background' patch to the list,\nmade improvements based on the feedback, and submitted the result two\nweeks ago without any further feedback.  I put my changes off of\nmaster, but gitk is identical in both maint and master.  Can you pull\nthe changes?\n\nbranch gitk_colors from\ngit://gitorious.org/~dfries/git/dfriess-git-mainline.git\n\nThis e-mail is also a replay to the last posting of the patches.\n\nOn Wed, Nov 10, 2010 at 10:59:54PM -0600, David Fries wrote:\n> The gitk preferences allow for the user to select different colors.\n> The setui is even set to dynamically detect how light or dark the\n> background is and set the selection color to be the opposite, but\n> there are a few other color selections that don't currently work with\n> a dark background such as the black outlines.  This patch improves the\n> color selection.  In some cases it just needs to use the current\n> forground color, other places it is more complicated.\n> \n> The gitk_colors branch can be pulled from,\n> git://gitorious.org/~dfries/git/dfriess-git-mainline.git\n> \n> my relevant .gitk config file settings,\n> \n> set mainfont {Helvetica 8}\n> set textfont {Courier 8}\n> set uifont {Helvetica 9 bold}\n> set uicolor grey85\n> set bgcolor black\n> set fgcolor white\n> set colors {green red blue magenta darkgrey brown orange}\n> set diffcolors {red green cyan}\n> set markbgcolor #404060\n> set selectbgcolor gray50\n\n-- \nDavid Fries <david@fries.net>\nhttp://fries.net/~david/ (PGP encryption key available)\n"},{"id":"156706","messageId":"7vd3prpn10.fsf@alter.siamese.dyndns.org","threadId":"25708","inReplyTo":"20101126224136.GA26477@spacedout.fries.net","subject":"Re: [PATCH 0/3] gitk: improve dark background","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-11-27T01:34:35Z","receivedAt":"2010-11-27T01:34:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Fries <david@fries.net> writes:\n\n> I submitted the 'gitk: improve dark background' patch to the list,\n> made improvements based on the feedback, and submitted the result two\n> weeks ago without any further feedback.  I put my changes off of\n> master, but gitk is identical in both maint and master.  Can you pull\n> the changes?\n\nI saw the patch, but I didn't really look at it (I don't use gitk very\noften, and I am an old-fashioned \"darker ink on lighter sheet\" user so I\nwouldn't be a good judge on your change).\n\nI don't take patches to gitk or git-gui directly to my tree.  Please Cc:\nthe maintainer of that part of the system (Paulus, whom I am Cc'ing this\nmessage) the next time.\n\nThanks.\n\n> branch gitk_colors from\n> git://gitorious.org/~dfries/git/dfriess-git-mainline.git\n>\n> This e-mail is also a replay to the last posting of the patches.\n>\n> On Wed, Nov 10, 2010 at 10:59:54PM -0600, David Fries wrote:\n>> The gitk preferences allow for the user to select different colors.\n>> The setui is even set to dynamically detect how light or dark the\n>> background is and set the selection color to be the opposite, but\n>> there are a few other color selections that don't currently work with\n>> a dark background such as the black outlines.  This patch improves the\n>> color selection.  In some cases it just needs to use the current\n>> forground color, other places it is more complicated.\n>> ...\n"}]}