Re: [INFO] Does Git GUI support Dark Mode on Windows 10 ?
From: Sashank Bandi <hidden>
Date: 2021-10-07 11:27:47
You are of course free to design your own theme, but I would suggest you try all these themes already available first and see if any of them fit your needs.
I have tried all of these themes. "default" seems like it will fit. I have some color changes and a preview linked at the bottom. If you agree with that, I will work on other pages/sections too.
quoted hunk ↗ jump to hunk
Anyway, I came up with a quick proof of concept for a theme selector. It has many limitations and is not fit to apply just yet, but it should help you get started. -- 8< -- Subject: [PATCH] git-gui: Add a very crude theme selector Tk themeing is not very well documented and is not easy to get right. Ideally one would want to set the theme for a toolkit in one standard, but it is hard to find that standard config for Tk and even harder to get it to work consistently. Add a theme selection menu to make the lives of the user easier. Those who would wish to use the Tk provided theme should be able to do so. This is a very crude patch and it does not really ensure that. This is more of a proof of concept. Signed-off-by: Pratyush Yadav <redacted> --- git-gui.sh | 4 ++++ lib/option.tcl | 1 + 2 files changed, 5 insertions(+)diff --git a/git-gui.sh b/git-gui.sh index 201524c..ff2ec1b 100755 --- a/git-gui.sh +++ b/git-gui.sh@@ -862,6 +862,9 @@ proc apply_config {} { set NS ttk bind [winfo class .] <<ThemeChanged>> [list InitTheme] pave_toplevel . + if {[get_config gui.theme] != {}} { + ttk::style theme use [get_config gui.theme] + } color::sync_with_theme } }@@ -895,6 +898,7 @@ set default_config(gui.fontdiff) [font configure font_diff] # TODO: this option should be added to the git-config documentation set default_config(gui.maxfilesdisplayed) 5000 set default_config(gui.usettk) 1 +set default_config(gui.theme) "default" set default_config(gui.warndetachedcommit) 1 set default_config(gui.tabsize) 8 set font_descs {diff --git a/lib/option.tcl b/lib/option.tcl index e43971b..acce160 100644 --- a/lib/option.tcl +++ b/lib/option.tcl@@ -160,6 +160,7 @@ proc do_options {} { {c gui.encoding {mc "Default File Contents Encoding"}} {b gui.warndetachedcommit {mc "Warn before committing to a detached head"}} {s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}} + {s gui.theme {mc "GUI theme"} {ttk::style theme names}} {b gui.displayuntracked {mc "Show untracked files"}} {i-1..99 gui.tabsize {mc "Tab spacing"}} } { --
Thank you. This helps me find the location of the options. I will further improve this. Here is the preview I said: https://pasteboard.co/rwUBvWbX6m66.png . The checkbox needs some tinkering. Looking forward to any suggestions.