gitk: use config settings for head/tag colors

The drawtags procedure currently uses headfgcolor for all label text, ignoring the tagfgcolor setting. The call to create the outline polygon for (non-tag) heads currently has the color for headoutlinecolor hardcoded to black. This patch maintains the variables for the non-tag refs so that heads are colored differently from non-head (non-tag) refs. The outline and fill colors for the non-head refs remain hardcoded to the prior values, black & #ddddff. Signed-off-by: Shannon Barber <sgbarber@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>

Shannon Barber committed Jan 13, 2026 at 06:28 UTC bcb4fd1799485afbb2391aa312f4d947274bd7d4
1 file changed +7 -4
gitk
+7 -4
@@ -6831,16 +6831,18 @@ proc drawtags {id x xt y1} {
6831 } else {
6832 # draw a head or other ref
6833 if {[incr nheads -1] >= 0} {
6834 - set col $headbgcolor
6834 + set refoutlinecol $headoutlinecolor
6835 + set reffillcol $headbgcolor
6836 if {$tag eq $mainhead} {
6837 set font mainfontbold
6838 }
6839 } else {
6839 - set col "#ddddff"
6840 + set refoutlinecol black
6841 + set reffillcol "#ddddff"
6842 }
6843 set xl [expr {$xl - $delta/2}]
6844 $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \
6843 - -width 1 -outline black -fill $col -tags tag.$id
6845 + -width 1 -outline $refoutlinecol -fill $reffillcol -tags tag.$id
6846 if {[regexp {^(remotes/.*/|remotes/)} $tag match remoteprefix]} {
6847 set rwid [font measure mainfont $remoteprefix]
6848 set xi [expr {$x + 1}]
@@ -6850,7 +6852,8 @@ proc drawtags {id x xt y1} {
6852 -width 0 -fill $remotebgcolor -tags tag.$id
6853 }
6854 }
6853 - set t [$canv create text $xl $y1 -anchor w -text $tag -fill $headfgcolor \
6855 + set textfgcolor [expr {$ntags >= 0 ? $tagfgcolor : $headfgcolor}]
6856 + set t [$canv create text $xl $y1 -anchor w -text $tag -fill $textfgcolor \
6857 -font $font -tags [list tag.$id text]]
6858 if {$ntags >= 0} {
6859 $canv bind $t <1> $tagclick