问题
Some days ago I bumped into this picture of git gui with a dark theme.
I have went through the documentation, search the menus for it and asked DuckDuckGo, but so far I have not figured out how to change the theme. How can it be done?
Edit: I work on Ubuntu 16.04 with a dark theme. Git gui completes ignores the theme settings of my DE, therefore I could not image it could be related, as kowsky suggests below.
回答1:
I suppose you took that picture from here?
The user issuing the screenshots states that
[...] I'm using Dark theme for my Windows, [...]
and
Git-GUI (main window) must use Windows native colors [...]
Thus, I suspect he achieved this "dark Theme" by setting his default windows color theme accordingly.
回答2:
The colours are hardcoded, defined in a file called choose_repository.tcl. Not sure about Ubuntu but in Windows it's located in C:\Program Files\Git\mingw64\share\git-gui\lib\choose_repository.tcl
. Change the colours to what you like. Mine looks like this with this patch:
@@ -91,17 +91,18 @@ constructor pick {} {
${NS}::frame $w_body
text $opts \
-cursor $::cursor_ptr \
-relief flat \
-background [get_bg_color $w_body] \
+ -foreground lime \
-wrap none \
-spacing1 5 \
-width 50 \
-height 3
pack $opts -anchor w -fill x
- $opts tag conf link_new -foreground blue -underline 1
+ $opts tag conf link_new -underline 1
$opts tag bind link_new <1> [cb _next new]
$opts insert end [mc "Create New Repository"] link_new
$opts insert end "\n"
if {$m_repo ne {}} {
$m_repo add command \
@@ -110,11 +111,11 @@ constructor pick {} {
-label [mc "New..."]
bind $top <$M1B-n> [cb _next new]
bind $top <$M1B-N> [cb _next new]
}
- $opts tag conf link_clone -foreground blue -underline 1
+ $opts tag conf link_clone -underline 1
$opts tag bind link_clone <1> [cb _next clone]
$opts insert end [mc "Clone Existing Repository"] link_clone
$opts insert end "\n"
if {$m_repo ne {}} {
if {[tk windowingsystem] eq "win32"} {
@@ -128,11 +129,11 @@ constructor pick {} {
-label [mc "Clone..."]
bind $top <$M1B-[string tolower $key]> [cb _next clone]
bind $top <$M1B-[string toupper $key]> [cb _next clone]
}
- $opts tag conf link_open -foreground blue -underline 1
+ $opts tag conf link_open -underline 1
$opts tag bind link_open <1> [cb _next open]
$opts insert end [mc "Open Existing Repository"] link_open
$opts insert end "\n"
if {$m_repo ne {}} {
$m_repo add command \
@@ -169,12 +170,12 @@ constructor pick {} {
-background [get_bg_color $w_body.recentlabel] \
-wrap none \
-width 50 \
-height $lenrecent
$w_recentlist tag conf link \
- -foreground blue \
- -underline 1
+ -foreground yellow \
+ -underline 0
set home $::env(HOME)
if {[is_Cygwin]} {
set home [exec cygpath --windows --absolute $home]
}
set home "[file normalize $home]/"
来源:https://stackoverflow.com/questions/49935684/dark-theme-for-git-gui