@@ -903,6 +903,8 @@ set font_descs {
}
set default_config(gui.stageuntracked) ask
set default_config(gui.displayuntracked) true
+set default_config(gui.foreground) black
+set default_config(gui.background) white
######################################################################
##
@@ -2004,7 +2006,7 @@ static unsigned char mask_bits[] = {
0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f};
}
-image create bitmap file_plain -background white -foreground black -data {
+image create bitmap file_plain -background [get_config gui.background] -foreground black -data {
#define plain_width 14
#define plain_height 15
static unsigned char plain_bits[] = {
@@ -2013,7 +2015,7 @@ static unsigned char plain_bits[] = {
0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
-image create bitmap file_mod -background white -foreground blue -data {
+image create bitmap file_mod -background [get_config gui.background] -foreground blue -data {
#define mod_width 14
#define mod_height 15
static unsigned char mod_bits[] = {
@@ -2022,7 +2024,7 @@ static unsigned char mod_bits[] = {
0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
-image create bitmap file_fulltick -background white -foreground "#007000" -data {
+image create bitmap file_fulltick -background [get_config gui.background] -foreground "#007000" -data {
#define file_fulltick_width 14
#define file_fulltick_height 15
static unsigned char file_fulltick_bits[] = {
@@ -2031,7 +2033,7 @@ static unsigned char file_fulltick_bits[] = {
0x62, 0x10, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
-image create bitmap file_question -background white -foreground black -data {
+image create bitmap file_question -background [get_config gui.background] -foreground black -data {
#define file_question_width 14
#define file_question_height 15
static unsigned char file_question_bits[] = {
@@ -2040,7 +2042,7 @@ static unsigned char file_question_bits[] = {
0x62, 0x10, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
-image create bitmap file_removed -background white -foreground red -data {
+image create bitmap file_removed -background [get_config gui.background] -foreground red -data {
#define file_removed_width 14
#define file_removed_height 15
static unsigned char file_removed_bits[] = {
@@ -2049,7 +2051,7 @@ static unsigned char file_removed_bits[] = {
0x1a, 0x16, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
-image create bitmap file_merge -background white -foreground blue -data {
+image create bitmap file_merge -background [get_config gui.background] -foreground blue -data {
#define file_merge_width 14
#define file_merge_height 15
static unsigned char file_merge_bits[] = {
@@ -2058,7 +2060,7 @@ static unsigned char file_merge_bits[] = {
0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f};
} -maskdata $filemask
-image create bitmap file_statechange -background white -foreground green -data {
+image create bitmap file_statechange -background [get_config gui.background] -foreground green -data {
#define file_statechange_width 14
#define file_statechange_height 15
static unsigned char file_statechange_bits[] = {
@@ -3187,7 +3189,9 @@ pack .vpane -anchor n -side top -fill both -expand 1
textframe .vpane.files.workdir -height 100 -width 200
tlabel .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
-background lightsalmon -foreground black
-ttext $ui_workdir -background white -foreground black \
+ttext $ui_workdir \
+ -background [get_config gui.background] \
+ -foreground [get_config gui.foreground] \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
@@ -3209,7 +3213,9 @@ textframe .vpane.files.index -height 100 -width 200
tlabel .vpane.files.index.title \
-text [mc "Staged Changes (Will Commit)"] \
-background lightgreen -foreground black
-ttext $ui_index -background white -foreground black \
+ttext $ui_index \
+ -background [get_config gui.background] \
+ -foreground [get_config gui.foreground] \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
@@ -3353,7 +3359,10 @@ if {![is_enabled nocommit]} {
}
textframe .vpane.lower.commarea.buffer.frame
-ttext $ui_comm -background white -foreground black \
+ttext $ui_comm \
+ -background [get_config gui.background] \
+ -foreground [get_config gui.foreground] \
+ -insertbackground [get_config gui.foreground] \
-borderwidth 1 \
-undo true \
-maxundo 20 \
@@ -3470,7 +3479,9 @@ bind_button3 .vpane.lower.diff.header.path "tk_popup $ctxm %X %Y"
#
textframe .vpane.lower.diff.body
set ui_diff .vpane.lower.diff.body.t
-ttext $ui_diff -background white -foreground black \
+ttext $ui_diff \
+ -background [get_config gui.background] \
+ -foreground [get_config gui.foreground] \
-borderwidth 0 \
-width 80 -height 5 -wrap none \
-font font_diff \
@@ -88,6 +88,14 @@ proc save_config {} {
}
}
+proc choose_color {title varname} {
+ upvar 1 $varname var
+ set color [tk_chooseColor -title $title -initialcolor $var]
+ if {$color ne ""} {
+ set var $color
+ }
+}
+
proc do_options {} {
global repo_config global_config font_descs
global repo_config_new global_config_new
@@ -162,6 +170,8 @@ proc do_options {} {
{s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}}
{b gui.displayuntracked {mc "Show untracked files"}}
{i-1..99 gui.tabsize {mc "Tab spacing"}}
+ {C gui.foreground {mc "Foreground Color"}}
+ {C gui.background {mc "Background Color"}}
} {
set type [lindex $option 0]
set name [lindex $option 1]
@@ -192,6 +202,7 @@ proc do_options {} {
pack $w.$f.$optid -side top -anchor w -fill x
}
c -
+ C -
t {
${NS}::frame $w.$f.$optid
${NS}::label $w.$f.$optid.l -text [mc "%s:" $text]
@@ -211,6 +222,11 @@ proc do_options {} {
-command [list popup_btn_menu \
$w.$f.$optid.m $w.$f.$optid.b]
pack $w.$f.$optid.b -side left -anchor w
+ } elseif {$type eq {C}} {
+ ${NS}::button $w.$f.$optid.b \
+ -text [mc "Change"] \
+ -command [list choose_color $text ${f}_config_new($name)]
+ pack $w.$f.$optid.b -side left -anchor w
}
pack $w.$f.$optid -side top -anchor w -fill x
}
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk> --- git-gui.sh | 33 ++++++++++++++++++++++----------- lib/option.tcl | 16 ++++++++++++++++ 2 files changed, 38 insertions(+), 11 deletions(-)