git-gui: if a background colour is set, set foreground colour as well

In several places, only the background colour is set to an explicit
value, sometimes even "white".  This does not work well with dark
colour themes.

This patch tries to set the foreground colour to "black" in those
situations, where an explicit background colour is set without defining
any foreground colour.

Signed-off-by: Philipp A. Hartmann <ph@sorgh.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Philipp A. Hartmann
2008-03-05 17:54:22 +01:00
committed by Shawn O. Pearce
parent 312fd92b06
commit c382fdd795
6 changed files with 47 additions and 16 deletions

View File

@ -2289,8 +2289,9 @@ pack .vpane -anchor n -side top -fill both -expand 1
# #
frame .vpane.files.index -height 100 -width 200 frame .vpane.files.index -height 100 -width 200
label .vpane.files.index.title -text [mc "Staged Changes (Will Commit)"] \ label .vpane.files.index.title -text [mc "Staged Changes (Will Commit)"] \
-background lightgreen -background lightgreen -foreground black
text $ui_index -background white -borderwidth 0 \ text $ui_index -background white -foreground black \
-borderwidth 0 \
-width 20 -height 10 \ -width 20 -height 10 \
-wrap none \ -wrap none \
-cursor $cursor_ptr \ -cursor $cursor_ptr \
@ -2308,8 +2309,9 @@ pack $ui_index -side left -fill both -expand 1
# #
frame .vpane.files.workdir -height 100 -width 200 frame .vpane.files.workdir -height 100 -width 200
label .vpane.files.workdir.title -text [mc "Unstaged Changes"] \ label .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
-background lightsalmon -background lightsalmon -foreground black
text $ui_workdir -background white -borderwidth 0 \ text $ui_workdir -background white -foreground black \
-borderwidth 0 \
-width 20 -height 10 \ -width 20 -height 10 \
-wrap none \ -wrap none \
-cursor $cursor_ptr \ -cursor $cursor_ptr \
@ -2416,7 +2418,8 @@ pack $ui_coml -side left -fill x
pack .vpane.lower.commarea.buffer.header.amend -side right pack .vpane.lower.commarea.buffer.header.amend -side right
pack .vpane.lower.commarea.buffer.header.new -side right pack .vpane.lower.commarea.buffer.header.new -side right
text $ui_comm -background white -borderwidth 1 \ text $ui_comm -background white -foreground black \
-borderwidth 1 \
-undo true \ -undo true \
-maxundo 20 \ -maxundo 20 \
-autoseparators true \ -autoseparators true \
@ -2493,15 +2496,18 @@ trace add variable current_diff_path write trace_current_diff_path
frame .vpane.lower.diff.header -background gold frame .vpane.lower.diff.header -background gold
label .vpane.lower.diff.header.status \ label .vpane.lower.diff.header.status \
-background gold \ -background gold \
-foreground black \
-width $max_status_desc \ -width $max_status_desc \
-anchor w \ -anchor w \
-justify left -justify left
label .vpane.lower.diff.header.file \ label .vpane.lower.diff.header.file \
-background gold \ -background gold \
-foreground black \
-anchor w \ -anchor w \
-justify left -justify left
label .vpane.lower.diff.header.path \ label .vpane.lower.diff.header.path \
-background gold \ -background gold \
-foreground black \
-anchor w \ -anchor w \
-justify left -justify left
pack .vpane.lower.diff.header.status -side left pack .vpane.lower.diff.header.status -side left
@ -2525,7 +2531,8 @@ bind_button3 .vpane.lower.diff.header.path "tk_popup $ctxm %X %Y"
# #
frame .vpane.lower.diff.body frame .vpane.lower.diff.body
set ui_diff .vpane.lower.diff.body.t set ui_diff .vpane.lower.diff.body.t
text $ui_diff -background white -borderwidth 0 \ text $ui_diff -background white -foreground black \
-borderwidth 0 \
-width 80 -height 15 -wrap none \ -width 80 -height 15 -wrap none \
-font font_diff \ -font font_diff \
-xscrollcommand {.vpane.lower.diff.body.sbx set} \ -xscrollcommand {.vpane.lower.diff.body.sbx set} \

View File

@ -80,6 +80,7 @@ constructor new {i_commit i_path} {
label $w.header.commit_l \ label $w.header.commit_l \
-text [mc "Commit:"] \ -text [mc "Commit:"] \
-background gold \ -background gold \
-foreground black \
-anchor w \ -anchor w \
-justify left -justify left
set w_back $w.header.commit_b set w_back $w.header.commit_b
@ -89,6 +90,7 @@ constructor new {i_commit i_path} {
-relief flat \ -relief flat \
-state disabled \ -state disabled \
-background gold \ -background gold \
-foreground black \
-activebackground gold -activebackground gold
bind $w_back <Button-1> " bind $w_back <Button-1> "
if {\[$w_back cget -state\] eq {normal}} { if {\[$w_back cget -state\] eq {normal}} {
@ -98,16 +100,19 @@ constructor new {i_commit i_path} {
label $w.header.commit \ label $w.header.commit \
-textvariable @commit \ -textvariable @commit \
-background gold \ -background gold \
-foreground black \
-anchor w \ -anchor w \
-justify left -justify left
label $w.header.path_l \ label $w.header.path_l \
-text [mc "File:"] \ -text [mc "File:"] \
-background gold \ -background gold \
-foreground black \
-anchor w \ -anchor w \
-justify left -justify left
set w_path $w.header.path set w_path $w.header.path
label $w_path \ label $w_path \
-background gold \ -background gold \
-foreground black \
-anchor w \ -anchor w \
-justify left -justify left
pack $w.header.commit_l -side left pack $w.header.commit_l -side left
@ -135,7 +140,9 @@ constructor new {i_commit i_path} {
-takefocus 0 \ -takefocus 0 \
-highlightthickness 0 \ -highlightthickness 0 \
-padx 0 -pady 0 \ -padx 0 -pady 0 \
-background white -borderwidth 0 \ -background white \
-foreground black \
-borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
@ -148,7 +155,9 @@ constructor new {i_commit i_path} {
-takefocus 0 \ -takefocus 0 \
-highlightthickness 0 \ -highlightthickness 0 \
-padx 0 -pady 0 \ -padx 0 -pady 0 \
-background white -borderwidth 0 \ -background white \
-foreground black \
-borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
@ -166,7 +175,9 @@ constructor new {i_commit i_path} {
-takefocus 0 \ -takefocus 0 \
-highlightthickness 0 \ -highlightthickness 0 \
-padx 0 -pady 0 \ -padx 0 -pady 0 \
-background white -borderwidth 0 \ -background white \
-foreground black \
-borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
@ -184,7 +195,9 @@ constructor new {i_commit i_path} {
-takefocus 0 \ -takefocus 0 \
-highlightthickness 0 \ -highlightthickness 0 \
-padx 0 -pady 0 \ -padx 0 -pady 0 \
-background white -borderwidth 0 \ -background white \
-foreground black \
-borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 40 \ -height 40 \
@ -213,7 +226,9 @@ constructor new {i_commit i_path} {
set w_cviewer $w.file_pane.cm.t set w_cviewer $w.file_pane.cm.t
text $w_cviewer \ text $w_cviewer \
-background white -borderwidth 0 \ -background white \
-foreground black \
-borderwidth 0 \
-state disabled \ -state disabled \
-wrap none \ -wrap none \
-height 10 \ -height 10 \

View File

@ -39,7 +39,8 @@ constructor new {commit {path {}}} {
frame $w.list frame $w.list
set w_list $w.list.l set w_list $w.list.l
text $w_list -background white -borderwidth 0 \ text $w_list -background white -foreground black \
-borderwidth 0 \
-cursor $cursor_ptr \ -cursor $cursor_ptr \
-state disabled \ -state disabled \
-wrap none \ -wrap none \

View File

@ -55,6 +55,7 @@ constructor pick {path title a_family a_size} {
set w_family $w.inner.family.v set w_family $w.inner.family.v
text $w_family \ text $w_family \
-background white \ -background white \
-foreground black \
-borderwidth 1 \ -borderwidth 1 \
-relief sunken \ -relief sunken \
-cursor $::cursor_ptr \ -cursor $::cursor_ptr \
@ -92,6 +93,7 @@ constructor pick {path title a_family a_size} {
set w_example $w.example.t set w_example $w.example.t
text $w_example \ text $w_example \
-background white \ -background white \
-foreground black \
-borderwidth 1 \ -borderwidth 1 \
-relief sunken \ -relief sunken \
-height 3 \ -height 3 \

View File

@ -46,7 +46,9 @@ method _init {} {
-justify left \ -justify left \
-font font_uibold -font font_uibold
text $w_t \ text $w_t \
-background white -borderwidth 1 \ -background white \
-foreground black \
-borderwidth 1 \
-relief sunken \ -relief sunken \
-width 80 -height 10 \ -width 80 -height 10 \
-wrap none \ -wrap none \
@ -180,7 +182,8 @@ method done {ok} {
if {$ok} { if {$ok} {
if {[winfo exists $w.m.s]} { if {[winfo exists $w.m.s]} {
bind $w.m.s <Destroy> [list delete_this $this] bind $w.m.s <Destroy> [list delete_this $this]
$w.m.s conf -background green -text [mc "Success"] $w.m.s conf -background green -foreground black \
-text [mc "Success"]
if {$is_toplevel} { if {$is_toplevel} {
$w.ok conf -state normal $w.ok conf -state normal
focus $w.ok focus $w.ok
@ -193,7 +196,8 @@ method done {ok} {
_init $this _init $this
} }
bind $w.m.s <Destroy> [list delete_this $this] bind $w.m.s <Destroy> [list delete_this $this]
$w.m.s conf -background red -text [mc "Error: Command Failed"] $w.m.s conf -background red -foreground black \
-text [mc "Error: Command Failed"]
if {$is_toplevel} { if {$is_toplevel} {
$w.ok conf -state normal $w.ok conf -state normal
focus $w.ok focus $w.ok

View File

@ -80,7 +80,9 @@ proc hook_failed_popup {hook msg {is_fatal 1}} {
-justify left \ -justify left \
-font font_uibold -font font_uibold
text $w.m.t \ text $w.m.t \
-background white -borderwidth 1 \ -background white \
-foreground black \
-borderwidth 1 \
-relief sunken \ -relief sunken \
-width 80 -height 10 \ -width 80 -height 10 \
-font font_diff \ -font font_diff \