threads / discuss / 56589

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

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

## tl;dr

15 messages between Sep 26, 2021 and Oct 7, 2021.

replies: 14people: 4as markdown or json

Sashank Bandi· Sep 26, 2021, 15:09 UTC · lore
Hello,
I am new to the concept of mailing lists so please bear with me.

I'm a JS developer. I love Git GUI for its minimalism in both size and layout. I have been using Git and Git GUI on Windows for a long time. I think the only thing missing from the "Official" Git GUI is dark mode.

I use dark mode on almost all places. Firefox, Discord, GitHub, Outlook, Notepad++, VS Code and even Reddit too. The only place that is missing dark mode in my workflow is Git GUI.

Is there any way I can make Git GUI dark mode ?

I don't know a lot of Tcl/Tk but I am currently trying to learn it. I did a few edits and made the About page in dark mode. You can look at it here: https://user-images.githubusercontent.com/76554862/134190271-d861407a-31be-436d-aac4-9ea3d72f0fb0.png .

I have found two threads in the mailing list but those are just dead ends for me. Hence I reached this mailing list.

Bagas Sanjaya· Sep 27, 2021, 06:32 UTC · re: Sashank Bandi · lore

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

On 26/09/21 22.09, Sashank Bandi wrote:
Show 24 quoted lines
> Hello,
> 
> I am new to the concept of mailing lists so please bear with me.
> 
> I'm a JS developer. I love Git GUI for its minimalism in both size and
> layout. I have been using Git and Git GUI on Windows for a long time.
> I think the only thing missing from the "Official" Git GUI is dark
> mode.
> 
> I use dark mode on almost all places. Firefox, Discord, GitHub,
> Outlook, Notepad++, VS Code and even Reddit too. The only place that
> is missing dark mode in my workflow is Git GUI.
> 
> Is there any way I can make Git GUI dark mode ?
> 
> I don't know a lot of Tcl/Tk but I am currently trying to learn it. I
> did a few edits and made the About page in dark mode.
> You can look at it here:
> https://user-images.githubusercontent.com/76554862/134190271-d861407a-31be-436d-aac4-9ea3d72f0fb0.png
> .
> 
> I have found two threads in the mailing list but those are just dead
> ends for me. Hence I reached this mailing list.
> 

I would rather like to see yourself posted PR to the dedicated subsytem at [1].

I think you want to implement tri-state `Dark mode` option. When it is set to `Yes`, always use dark theme regardless of system settings; when it is `No` the opposite; and `Auto` use dark theme when it is enabled in system settings, normal the opposite.

[1]: https://github.com/prati0100/git-gui.git
-- 
An old man doll... just what I always wanted! - Clara
Sashank Bandi· Sep 27, 2021, 10:19 UTC · re: Bagas Sanjaya · lore

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

On Mon, Sep 27, 2021 at 12:02 PM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
Show 29 quoted lines
>
> On 26/09/21 22.09, Sashank Bandi wrote:
> > Hello,
> >
> > I am new to the concept of mailing lists so please bear with me.
> >
> > I'm a JS developer. I love Git GUI for its minimalism in both size and
> > layout. I have been using Git and Git GUI on Windows for a long time.
> > I think the only thing missing from the "Official" Git GUI is dark
> > mode.
> >
> > I use dark mode on almost all places. Firefox, Discord, GitHub,
> > Outlook, Notepad++, VS Code and even Reddit too. The only place that
> > is missing dark mode in my workflow is Git GUI.
> >
> > Is there any way I can make Git GUI dark mode ?
> >
> > I don't know a lot of Tcl/Tk but I am currently trying to learn it. I
> > did a few edits and made the About page in dark mode.
> > You can look at it here:
> > https://user-images.githubusercontent.com/76554862/134190271-d861407a-31be-436d-aac4-9ea3d72f0fb0.png
> > .
> >
> > I have found two threads in the mailing list but those are just dead
> > ends for me. Hence I reached this mailing list.
> >
>
> I would rather like to see yourself posted PR to the dedicated subsytem
> at [1].

Nice to hear that you like my design. I think this confirms my suspicion that there is no "Official" Git GUI Dark Mode on Windows 10.

> I think you want to implement tri-state `Dark mode` option. When it is
> set to `Yes`, always use dark theme regardless of system settings; when
> it is `No` the opposite; and `Auto` use dark theme when it is enabled in
> system settings, normal the opposite.
Our interests conflict here.
I think we should rather provide 3 different options here.
1. System Default
2. Light Mode
3. Dark Mode
I find these options easy rather than the "Yes" or "No" options.

I'm currently planning to convert this into a C++ program as there is no way from the Tcl itself to change the color and background color of the title bar or menu of the Git GUI window.

I also CCed Pratyush Yadav as he is the official maintainer of the project.
Bagas Sanjaya· Sep 27, 2021, 10:39 UTC · re: Sashank Bandi · lore

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

On 27/09/21 17.19, Sashank Bandi wrote:
Show 6 quoted lines
> I'm currently planning to convert this into a C++ program as there is no
> way from the Tcl itself to change the color and background color of the title
> bar or menu of the Git GUI window.
> 
> I also CCed Pratyush Yadav as he is the official maintainer of the project.
> 

Regarding GUI toolkit, you should pick the replacement carefully - tooling used in Git for Windows will need to be adapted in order to compile your chosen toolkit (whether it is Qt, GTK, or wxWidgets) for Windows.

CC also Johannes Schindelin for comments.
-- 
An old man doll... just what I always wanted! - Clara
Sashank Bandi· Sep 27, 2021, 10:51 UTC · re: Bagas Sanjaya · lore

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

I forgot to mention that we also have an alternative.

We can completely ditch C++ idea here and instead remove the native title bar or border that the Window Manager gives and instead draw our own title bar in Tcl/Tk. But that means rewriting the menu system.

So, I'm waiting for the decision of Pratyush Yadav here.
> Regarding GUI toolkit, you should pick the replacement carefully -
> tooling used in Git for Windows will need to be adapted in order to
> compile your chosen toolkit (whether it is Qt, GTK, or wxWidgets) for
> Windows.

No, I'm not choosing a toolkit. Whatever I will do, it will be in native C++ without any other toolkit. It might be a little hard, but it is better than including another whole library in here. Lightweight is a reason I chose Git GUI and I will make sure that my contribution does not make that go.

Show 5 quoted lines
>
> CC also Johannes Schindelin for comments.
>
> --
> An old man doll... just what I always wanted! - Clara
David Aguilar· Sep 27, 2021, 18:08 UTC · re: Bagas Sanjaya · lore

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

On Mon, Sep 27, 2021 at 3:41 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
Show 13 quoted lines
>
> On 27/09/21 17.19, Sashank Bandi wrote:
> > I'm currently planning to convert this into a C++ program as there is no
> > way from the Tcl itself to change the color and background color of the title
> > bar or menu of the Git GUI window.
> >
> > I also CCed Pratyush Yadav as he is the official maintainer of the project.
> >
>
> Regarding GUI toolkit, you should pick the replacement carefully -
> tooling used in Git for Windows will need to be adapted in order to
> compile your chosen toolkit (whether it is Qt, GTK, or wxWidgets) for
> Windows.
Have you tried git cola? [1]
It uses Qt. It's cross-platform and written in Python.

Git GUI is useful because it's built in, but from a usability perspective cola has many advantages.

It has a dark mode that works more or less how you described:
- system default
- user-specified theme (dark/light with a few color variations)

.. and beyond these rather small differences, git cola even has image diffs[2]. That alone is a killer feature.

[1] https://github.com/git-cola/git-cola/
[2] http://git-cola.github.io/screenshots.html
-- 
David
Sashank Bandi· Sep 28, 2021, 03:21 UTC · re: David Aguilar · lore

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

On Mon, Sep 27, 2021 at 11:39 PM David Aguilar <davvid@gmail.com> wrote:
> Have you tried git cola? [1]
Yes, I did try it.
> Git GUI is useful because it's built in, but from a usability
> perspective cola has many advantages.

But it is just too much for my very light usage. I want something light and embedded in Git for Windows itself.

> .. and beyond these rather small differences, git cola even has image
> diffs[2]. That alone is a killer feature.
It is a really great feature. But it isn't useful for me in my projects.

I have looked at tortoise Git, Git Cola, lazygit and some others too but Git GUI seems perfect for my usage, except dark mode.

Sashank Bandi· Oct 3, 2021, 14:33 UTC · re: Sashank Bandi · lore

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

Hey! Is there any way to reach Pratyush Yadav ? This thread has been stale for days.

On Tue, Sep 28, 2021 at 8:51 AM Sashank Bandi <bandi.rao999@gmail.com> wrote:
Show 16 quoted lines
>
> On Mon, Sep 27, 2021 at 11:39 PM David Aguilar <davvid@gmail.com> wrote:
> > Have you tried git cola? [1]
> Yes, I did try it.
>
> > Git GUI is useful because it's built in, but from a usability
> > perspective cola has many advantages.
> But it is just too much for my very light usage. I want something
> light and embedded in Git for Windows itself.
>
> > .. and beyond these rather small differences, git cola even has image
> > diffs[2]. That alone is a killer feature.
> It is a really great feature. But it isn't useful for me in my projects.
>
> I have looked at tortoise Git, Git Cola, lazygit and some others too
> but Git GUI seems perfect for my usage, except dark mode.
Bagas Sanjaya· Oct 4, 2021, 03:29 UTC · re: Sashank Bandi · lore

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

On 03/10/21 21.33, Sashank Bandi wrote:
> Hey!
> Is there any way to reach Pratyush Yadav ?
> This thread has been stale for days.
CC'ing Junio for now.
-- 
An old man doll... just what I always wanted! - Clara
Pratyush Yadav· Oct 4, 2021, 07:56 UTC · re: Sashank Bandi · lore

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

Hi Sashank,
On 03/10/21 08:03PM, Sashank Bandi wrote:
> Hey!
> Is there any way to reach Pratyush Yadav ?
> This thread has been stale for days.

Sorry, I couldn't find time to catch up on this because its been busy at $DAYJOB.

Anyway, git-gui does have some basic dark mode support, though I have seen reports that it does not work very well. You can change the Tk theme and it should enable dark mode on git-gui as well. See [0] for some more info. I am not very familiar with how Tk theming would work on Windows.

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.

[0] https://lore.kernel.org/all/20201008082004.5643-1-serg.partizan@gmail.com/
Show 18 quoted lines
> 
> On Tue, Sep 28, 2021 at 8:51 AM Sashank Bandi <bandi.rao999@gmail.com> wrote:
> >
> > On Mon, Sep 27, 2021 at 11:39 PM David Aguilar <davvid@gmail.com> wrote:
> > > Have you tried git cola? [1]
> > Yes, I did try it.
> >
> > > Git GUI is useful because it's built in, but from a usability
> > > perspective cola has many advantages.
> > But it is just too much for my very light usage. I want something
> > light and embedded in Git for Windows itself.
> >
> > > .. and beyond these rather small differences, git cola even has image
> > > diffs[2]. That alone is a killer feature.
> > It is a really great feature. But it isn't useful for me in my projects.
> >
> > I have looked at tortoise Git, Git Cola, lazygit and some others too
> > but Git GUI seems perfect for my usage, except dark mode.
-- 
Regards,
Pratyush Yadav
Sashank Bandi· Oct 4, 2021, 15:09 UTC · re: Pratyush Yadav · lore

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

On Mon, Oct 4, 2021 at 1:26 PM Pratyush Yadav <me@yadavpratyush.com> wrote:
> Sorry, I couldn't find time to catch up on this because its been busy at
> $DAYJOB.
Well, I hope you got a little time for this thread.
Show 5 quoted lines
> Anyway, git-gui does have some basic dark mode support, though I have
> seen reports that it does not work very well. You can change the Tk
> theme and it should enable dark mode on git-gui as well. See [0] for
> some more info. I am not very familiar with how Tk theming would work on
> Windows.

I am not even familiar with Tcl/Tk language itself. But from what I have found, the Tk uses "vista" theme which is Windows-only default theme.

> 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.

> [0] https://lore.kernel.org/all/20201008082004.5643-1-serg.partizan@gmail.com/

Well, this works only for Linux as Windows doesn't use X Server. But we can use `ttk::style theme use` for it all over the application.

My plan is to use a new theme, that is based on default, but can imitate the look of [0].

[0]: https://github.com/TkinterEP/ttkthemes/blob/master/ttkthemes/png/equilux/equilux.tcl
Pratyush Yadav· Oct 6, 2021, 11:39 UTC · re: Sashank Bandi · lore

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

On 04/10/21 08:39PM, Sashank Bandi wrote:
Show 13 quoted lines
> On Mon, Oct 4, 2021 at 1:26 PM Pratyush Yadav <me@yadavpratyush.com> wrote:
> > Sorry, I couldn't find time to catch up on this because its been busy at
> > $DAYJOB.
> Well, I hope you got a little time for this thread.
> 
> > Anyway, git-gui does have some basic dark mode support, though I have
> > seen reports that it does not work very well. You can change the Tk
> > theme and it should enable dark mode on git-gui as well. See [0] for
> > some more info. I am not very familiar with how Tk theming would work on
> > Windows.
> I am not even familiar with Tcl/Tk language itself. But from what I
> have found, the Tk uses "vista" theme which is Windows-only default
> theme.

Does the Windows installation come with any other themes? You can use `ttk::style theme names` to list all available themes.

Show 5 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.
> 
> > [0] https://lore.kernel.org/all/20201008082004.5643-1-serg.partizan@gmail.com/
> Well, this works only for Linux as Windows doesn't use X Server. But
> we can use `ttk::style theme use` for it all over the application.
Right.
> 
> My plan is to use a new theme, that is based on default, but can
> imitate the look of [0].

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.

> 
> [0]: https://github.com/TkinterEP/ttkthemes/blob/master/ttkthemes/png/equilux/equilux.tcl
-- 
Regards,
Pratyush Yadav
Sashank Bandi· Oct 6, 2021, 14:45 UTC · re: Pratyush Yadav · lore

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

> 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".

Show 6 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.

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.

[0]: https://wiki.tcl-lang.org/page/List+of+ttk+Themes
Pratyush Yadav· Oct 6, 2021, 18:03 UTC · re: Sashank Bandi · lore

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

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
Sashank Bandi· Oct 7, 2021, 11:27 UTC · re: Pratyush Yadav · lore

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

> 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.

Show 59 quoted lines
> 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"}}
>                 } {
> --

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.

← back to recent threads