git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] gitk: improve dark background, use diffcolor 2 for link

From
David Fries <david@fries.net>
Date
Nov 11, 2010, 05:19 UTC
Message-ID
<1289452742-7235-2-git-send-email-david@fries.net>
In-Reply-To
<1289451597-6950-1-git-send-email-david@fries.net>

blue on a black background might as well look like dark blue on black and is very difficult to read. The "Diff: hunk header" keeps the colors more consistent and both default to blue.

Signed-off-by: David Fries <David@Fries.net>
---
 gitk-git/gitk |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index af43353..bef2e53 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -6673,7 +6673,7 @@ proc appendwithlinks {text tags} {
 }
 
 proc setlink {id lk} {
-    global curview ctext pendinglinks
+    global curview ctext pendinglinks diffcolors
 
     set known 0
     if {[string length $id] < 40} {
@@ -6687,7 +6687,7 @@ proc setlink {id lk} {
 	set known [commitinview $id $curview]
     }
     if {$known} {
-	$ctext tag conf $lk -foreground blue -underline 1
+	$ctext tag conf $lk -foreground [lindex $diffcolors 2] -underline 1
 	$ctext tag bind $lk <1> [list selbyid $id]
 	$ctext tag bind $lk <Enter> {linkcursor %W 1}
 	$ctext tag bind $lk <Leave> {linkcursor %W -1}
@@ -10792,8 +10792,7 @@ proc doprefs {} {
     label $top.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]
     ${NS}::button $top.hunksepbut -text [mc "Diff: hunk header"] \
 	-command [list choosecolor diffcolors 2 $top.hunksep \
-		      [mc "diff hunk header"] \
-		      [list $ctext tag conf hunksep -foreground]]
+		      [mc "diff hunk header"] sethunksep ]
     grid x $top.hunksepbut $top.hunksep -sticky w
     label $top.markbgsep -padx 40 -relief sunk -background $markbgcolor
     ${NS}::button $top.markbgbut -text [mc "Marked line bg"] \
@@ -10890,6 +10889,19 @@ proc setfg {c} {
     $canv itemconf line -fill $c
 }
 
+# update hunksep and each link foreground color
+proc sethunksep {c} {
+    global ctext linknum
+
+    $ctext tag conf hunksep -foreground $c
+    for {set i 0} {$i < $linknum} {incr i} {
+        # Use -underline to determine if it is a known link and gets this color
+        if {[$ctext tag cget link$i -underline] != ""} {
+            $ctext tag conf link$i -foreground $c
+        }
+    }
+}
+
 proc prefscan {} {
     global oldprefs prefstop
 
-- 
1.7.2.3
Previous: David FriesNext: David Fries
Message 3 of 6 in “gitk: improve dark background”
  1. 0/3 gitk: improve dark backgroundDavid Fries, Nov 11, 2010
  2. 1/3 gitk: improve dark background, s/black/$fgcolor/David Fries, Nov 11, 2010
  3. 2/3 gitk: improve dark background, use diffcolor 2 for linkDavid Fries, Nov 11, 2010
  4. 3/3 gitk: improve dark background, select light or dark tagsDavid Fries, Nov 11, 2010
  5. 0/3 gitk: improve dark backgroundDavid Fries, Nov 26, 2010
  6. Junio C HamanoNov 27, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.