git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [INFO] Does Git GUI support Dark Mode on Windows 10 ?

From
Pratyush Yadav <me@yadavpratyush.com>
Date
Oct 6, 2021, 18:03 UTC
Message-ID
<20211006180348.22e5c2z4pqkwtokx@yadavpratyush.com>
In-Reply-To
<CABkJDHFap2DmjMr1Ri-Mrud+msChB3uEGRKYyczAxfmaLnF6jA@mail.gmail.com>
On 06/10/21 08:15PM, Sashank Bandi wrote:
Show 9 quoted lines
> > Does the Windows installation come with any other themes? You can use
> > `ttk::style theme names` to list all available themes.
> It contains all these themes in Windows 10 x64.
> "winnative clam alt default classic vista xpnative"
> Based of [0] (the best source I could find),
> "winnative", "vista", "xpnative" are Windows-only but built-in themes and
> "clam", "alt", "default", "classic" are built-in themes for all OSes.
> And this is part of the reason I am considering "default" to be the
> base of the new theme that I want to create instead of "vista".

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.

Show 17 quoted lines
> 
> > > > I think it would be nice if we can have a theme picker in the options
> > > > menu though, so that is something you might want to look into.
> > > Yes, I thought of adding a menu between "Tools" and "Help". It will
> > > contain 3 options(system, light, dark) as I said before.
> >
> > I think it would be better to put it in the "options" dialog.
> Ok.
> 
> > I don't mind carrying themes in the git-gui repo since Tk theming
> > support is not very well documented or standardized. But please do be
> > careful of licence compatibility when porting code.
> No, I want to imitate the look. And I don't actually know much about
> the license or legal side of the software so I try to avoid it at all
> costs and start from scratch.
> Kinda like "Linux is Unix-like, but it doesn't contain Unix's code" -
> The great Linus Torvalds.

Well, I am not expert on software licenses either. Though using a quick Google search for license compatibility generally does the trick for me.

> 
> The "equilux" theme is GPLv3, but I didn't find a license file in the
> repo. In the "Help > About" part of Git GUI, you mentioned it being
> GPL(I think v1). Please include it in the repo too.

git-gui is GPL v2 or later. So I would assume it is compatible with GPL v3 but I am not entirely sure.

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 <me@yadavpratyush.com>
---
 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"}}
 		} {
-- 
Regards,
Pratyush Yadav
Previous: Sashank BandiNext: Sashank Bandi
Message 14 of 15 in “[INFO] Does Git GUI support Dark Mode on Windows 10 ?”
  1. Sashank BandiSep 26, 2021
  2. Bagas SanjayaSep 27, 2021
  3. Sashank BandiSep 27, 2021
  4. Bagas SanjayaSep 27, 2021
  5. Sashank BandiSep 27, 2021
  6. David AguilarSep 27, 2021
  7. Sashank BandiSep 28, 2021
  8. Sashank BandiOct 3, 2021
  9. Bagas SanjayaOct 4, 2021
  10. Pratyush YadavOct 4, 2021
  11. Sashank BandiOct 4, 2021
  12. Pratyush YadavOct 6, 2021
  13. Sashank BandiOct 6, 2021
  14. Pratyush YadavOct 6, 2021
  15. Sashank BandiOct 7, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.