{"thread":{"id":"12520","subject":"[PATCH] git-gui: if a background colour is set, set foreground colour as well","startedAt":"2008-03-05T16:54:22Z","lastAt":"2008-03-06T04:49:48Z","messageCount":2,"participants":["Philipp A. Hartmann","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"71101","messageId":"1204736062-11659-1-git-send-email-ph@sorgh.de","threadId":"12520","inReplyTo":null,"subject":"[PATCH] git-gui: if a background colour is set, set foreground colour as well","fromName":"Philipp A. Hartmann","fromEmail":"ph@sorgh.de","sentAt":"2008-03-05T16:54:22Z","receivedAt":"2008-03-05T16:54:22Z","isPatch":true,"sender":{"key":"pah@qo.cx","avatar":"https://avatars.githubusercontent.com/u/177333?v=4"},"body":"In several places, only the background colour is set to an explicit\nvalue, sometimes even \"white\".  This does not work well with dark\ncolour themes.\n\nThis patch tries to set the foreground colour to \"black\" in those\nsituations, where an explicit background colour is set without defining\nany foreground colour.\n\nSigned-off-by: Philipp A. Hartmann <ph@sorgh.de>\n---\n\n   Many GUI applications have \"problems\" with dark desktop themes,\n   because frequently only the background _or_ the foreground colours\n   are set to fixed values.  This results in barely readable parts of\n   the user interface when using bright-on-dark colour schemes.\n\n   The effects within git-gui can be seen e.g. on the following\n   screenshots (with and without this patch):\n\n     http://sorgh.de/tmp/git-gui/master.png\n     http://sorgh.de/tmp/git-gui/fg-colour-fix.png\n\n   This patch is against f15b75855fe15ac54adc4908f65e8a7572d47c9f\n   from git://repo.or.cz/git-gui.git - I could of course provide\n   one against git.git itself, if required.\n\n   Thanks for your time!\n\n git-gui.sh          |   19 +++++++++++++------\n lib/blame.tcl       |   25 ++++++++++++++++++++-----\n lib/browser.tcl     |    3 ++-\n lib/choose_font.tcl |    2 ++\n lib/console.tcl     |   10 +++++++---\n lib/error.tcl       |    4 +++-\n 6 files changed, 47 insertions(+), 16 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 238a239..8741443 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -2289,8 +2289,9 @@ pack .vpane -anchor n -side top -fill both -expand 1\n #\n frame .vpane.files.index -height 100 -width 200\n label .vpane.files.index.title -text [mc \"Staged Changes (Will Commit)\"] \\\n-\t-background lightgreen\n-text $ui_index -background white -borderwidth 0 \\\n+\t-background lightgreen -foreground black\n+text $ui_index -background white -foreground black \\\n+\t-borderwidth 0 \\\n \t-width 20 -height 10 \\\n \t-wrap none \\\n \t-cursor $cursor_ptr \\\n@@ -2308,8 +2309,9 @@ pack $ui_index -side left -fill both -expand 1\n #\n frame .vpane.files.workdir -height 100 -width 200\n label .vpane.files.workdir.title -text [mc \"Unstaged Changes\"] \\\n-\t-background lightsalmon\n-text $ui_workdir -background white -borderwidth 0 \\\n+\t-background lightsalmon -foreground black\n+text $ui_workdir -background white -foreground black \\\n+\t-borderwidth 0 \\\n \t-width 20 -height 10 \\\n \t-wrap none \\\n \t-cursor $cursor_ptr \\\n@@ -2416,7 +2418,8 @@ pack $ui_coml -side left -fill x\n pack .vpane.lower.commarea.buffer.header.amend -side right\n pack .vpane.lower.commarea.buffer.header.new -side right\n \n-text $ui_comm -background white -borderwidth 1 \\\n+text $ui_comm -background white -foreground black \\\n+\t-borderwidth 1 \\\n \t-undo true \\\n \t-maxundo 20 \\\n \t-autoseparators true \\\n@@ -2493,15 +2496,18 @@ trace add variable current_diff_path write trace_current_diff_path\n frame .vpane.lower.diff.header -background gold\n label .vpane.lower.diff.header.status \\\n \t-background gold \\\n+\t-foreground black \\\n \t-width $max_status_desc \\\n \t-anchor w \\\n \t-justify left\n label .vpane.lower.diff.header.file \\\n \t-background gold \\\n+\t-foreground black \\\n \t-anchor w \\\n \t-justify left\n label .vpane.lower.diff.header.path \\\n \t-background gold \\\n+\t-foreground black \\\n \t-anchor w \\\n \t-justify left\n pack .vpane.lower.diff.header.status -side left\n@@ -2525,7 +2531,8 @@ bind_button3 .vpane.lower.diff.header.path \"tk_popup $ctxm %X %Y\"\n #\n frame .vpane.lower.diff.body\n set ui_diff .vpane.lower.diff.body.t\n-text $ui_diff -background white -borderwidth 0 \\\n+text $ui_diff -background white -foreground black \\\n+\t-borderwidth 0 \\\n \t-width 80 -height 15 -wrap none \\\n \t-font font_diff \\\n \t-xscrollcommand {.vpane.lower.diff.body.sbx set} \\\ndiff --git a/lib/blame.tcl b/lib/blame.tcl\nindex 00ecf21..92fac1b 100644\n--- a/lib/blame.tcl\n+++ b/lib/blame.tcl\n@@ -80,6 +80,7 @@ constructor new {i_commit i_path} {\n \tlabel $w.header.commit_l \\\n \t\t-text [mc \"Commit:\"] \\\n \t\t-background gold \\\n+\t\t-foreground black \\\n \t\t-anchor w \\\n \t\t-justify left\n \tset w_back $w.header.commit_b\n@@ -89,6 +90,7 @@ constructor new {i_commit i_path} {\n \t\t-relief flat \\\n \t\t-state disabled \\\n \t\t-background gold \\\n+\t\t-foreground black \\\n \t\t-activebackground gold\n \tbind $w_back <Button-1> \"\n \t\tif {\\[$w_back cget -state\\] eq {normal}} {\n@@ -98,16 +100,19 @@ constructor new {i_commit i_path} {\n \tlabel $w.header.commit \\\n \t\t-textvariable @commit \\\n \t\t-background gold \\\n+\t\t-foreground black \\\n \t\t-anchor w \\\n \t\t-justify left\n \tlabel $w.header.path_l \\\n \t\t-text [mc \"File:\"] \\\n \t\t-background gold \\\n+\t\t-foreground black \\\n \t\t-anchor w \\\n \t\t-justify left\n \tset w_path $w.header.path\n \tlabel $w_path \\\n \t\t-background gold \\\n+\t\t-foreground black \\\n \t\t-anchor w \\\n \t\t-justify left\n \tpack $w.header.commit_l -side left\n@@ -135,7 +140,9 @@ constructor new {i_commit i_path} {\n \t\t-takefocus 0 \\\n \t\t-highlightthickness 0 \\\n \t\t-padx 0 -pady 0 \\\n-\t\t-background white -borderwidth 0 \\\n+\t\t-background white \\\n+\t\t-foreground black \\\n+\t\t-borderwidth 0 \\\n \t\t-state disabled \\\n \t\t-wrap none \\\n \t\t-height 40 \\\n@@ -148,7 +155,9 @@ constructor new {i_commit i_path} {\n \t\t-takefocus 0 \\\n \t\t-highlightthickness 0 \\\n \t\t-padx 0 -pady 0 \\\n-\t\t-background white -borderwidth 0 \\\n+\t\t-background white \\\n+\t\t-foreground black \\\n+\t\t-borderwidth 0 \\\n \t\t-state disabled \\\n \t\t-wrap none \\\n \t\t-height 40 \\\n@@ -166,7 +175,9 @@ constructor new {i_commit i_path} {\n \t\t-takefocus 0 \\\n \t\t-highlightthickness 0 \\\n \t\t-padx 0 -pady 0 \\\n-\t\t-background white -borderwidth 0 \\\n+\t\t-background white \\\n+\t\t-foreground black \\\n+\t\t-borderwidth 0 \\\n \t\t-state disabled \\\n \t\t-wrap none \\\n \t\t-height 40 \\\n@@ -184,7 +195,9 @@ constructor new {i_commit i_path} {\n \t\t-takefocus 0 \\\n \t\t-highlightthickness 0 \\\n \t\t-padx 0 -pady 0 \\\n-\t\t-background white -borderwidth 0 \\\n+\t\t-background white \\\n+\t\t-foreground black \\\n+\t\t-borderwidth 0 \\\n \t\t-state disabled \\\n \t\t-wrap none \\\n \t\t-height 40 \\\n@@ -213,7 +226,9 @@ constructor new {i_commit i_path} {\n \n \tset w_cviewer $w.file_pane.cm.t\n \ttext $w_cviewer \\\n-\t\t-background white -borderwidth 0 \\\n+\t\t-background white \\\n+\t\t-foreground black \\\n+\t\t-borderwidth 0 \\\n \t\t-state disabled \\\n \t\t-wrap none \\\n \t\t-height 10 \\\ndiff --git a/lib/browser.tcl b/lib/browser.tcl\nindex 53d5a62..ab470d1 100644\n--- a/lib/browser.tcl\n+++ b/lib/browser.tcl\n@@ -39,7 +39,8 @@ constructor new {commit {path {}}} {\n \n \tframe $w.list\n \tset w_list $w.list.l\n-\ttext $w_list -background white -borderwidth 0 \\\n+\ttext $w_list -background white -foreground black \\\n+\t\t-borderwidth 0 \\\n \t\t-cursor $cursor_ptr \\\n \t\t-state disabled \\\n \t\t-wrap none \\\ndiff --git a/lib/choose_font.tcl b/lib/choose_font.tcl\nindex 0c4051b..56443b0 100644\n--- a/lib/choose_font.tcl\n+++ b/lib/choose_font.tcl\n@@ -55,6 +55,7 @@ constructor pick {path title a_family a_size} {\n \tset w_family $w.inner.family.v\n \ttext $w_family \\\n \t\t-background white \\\n+\t\t-foreground black \\\n \t\t-borderwidth 1 \\\n \t\t-relief sunken \\\n \t\t-cursor $::cursor_ptr \\\n@@ -92,6 +93,7 @@ constructor pick {path title a_family a_size} {\n \tset w_example $w.example.t\n \ttext $w_example \\\n \t\t-background white \\\n+\t\t-foreground black \\\n \t\t-borderwidth 1 \\\n \t\t-relief sunken \\\n \t\t-height 3 \\\ndiff --git a/lib/console.tcl b/lib/console.tcl\nindex 5597188..c112464 100644\n--- a/lib/console.tcl\n+++ b/lib/console.tcl\n@@ -46,7 +46,9 @@ method _init {} {\n \t\t-justify left \\\n \t\t-font font_uibold\n \ttext $w_t \\\n-\t\t-background white -borderwidth 1 \\\n+\t\t-background white \\\n+\t\t-foreground black \\\n+\t\t-borderwidth 1 \\\n \t\t-relief sunken \\\n \t\t-width 80 -height 10 \\\n \t\t-wrap none \\\n@@ -180,7 +182,8 @@ method done {ok} {\n \tif {$ok} {\n \t\tif {[winfo exists $w.m.s]} {\n \t\t\tbind $w.m.s <Destroy> [list delete_this $this]\n-\t\t\t$w.m.s conf -background green -text [mc \"Success\"]\n+\t\t\t$w.m.s conf -background green -foreground black \\\n+\t\t\t\t-text [mc \"Success\"]\n \t\t\tif {$is_toplevel} {\n \t\t\t\t$w.ok conf -state normal\n \t\t\t\tfocus $w.ok\n@@ -193,7 +196,8 @@ method done {ok} {\n \t\t\t_init $this\n \t\t}\n \t\tbind $w.m.s <Destroy> [list delete_this $this]\n-\t\t$w.m.s conf -background red -text [mc \"Error: Command Failed\"]\n+\t\t$w.m.s conf -background red -foreground black \\\n+\t\t\t-text [mc \"Error: Command Failed\"]\n \t\tif {$is_toplevel} {\n \t\t\t$w.ok conf -state normal\n \t\t\tfocus $w.ok\ndiff --git a/lib/error.tcl b/lib/error.tcl\nindex 8c27678..7565015 100644\n--- a/lib/error.tcl\n+++ b/lib/error.tcl\n@@ -80,7 +80,9 @@ proc hook_failed_popup {hook msg {is_fatal 1}} {\n \t\t-justify left \\\n \t\t-font font_uibold\n \ttext $w.m.t \\\n-\t\t-background white -borderwidth 1 \\\n+\t\t-background white \\\n+\t\t-foreground black \\\n+\t\t-borderwidth 1 \\\n \t\t-relief sunken \\\n \t\t-width 80 -height 10 \\\n \t\t-font font_diff \\\n-- \n1.5.4.3.447.gc95b3\n\n"},{"id":"71182","messageId":"20080306044948.GM8410@spearce.org","threadId":"12520","inReplyTo":"1204736062-11659-1-git-send-email-ph@sorgh.de","subject":"Re: [PATCH] git-gui: if a background colour is set, set foreground colour as well","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-03-06T04:49:48Z","receivedAt":"2008-03-06T04:49:48Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Philipp A. Hartmann\" <ph@sorgh.de> wrote:\n> In several places, only the background colour is set to an explicit\n> value, sometimes even \"white\".  This does not work well with dark\n> colour themes.\n> \n> This patch tries to set the foreground colour to \"black\" in those\n> situations, where an explicit background colour is set without defining\n> any foreground colour.\n\nThanks.  Applied to `master`.\n \n>    This patch is against f15b75855fe15ac54adc4908f65e8a7572d47c9f\n>    from git://repo.or.cz/git-gui.git - I could of course provide\n>    one against git.git itself, if required.\n\nTotally unnecessary.  Patches against git-gui.git are preferred\nover patches made against git.git.\n\n-- \nShawn.\n"}]}