threads / discuss / 57073

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

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

## tl;dr

4 messages between Dec 13, 2021 and Jan 17, 2022.

replies: 3people: 2as markdown or json

Birger Skogeng Pedersen· Dec 13, 2021, 08:03 UTC · lore
Hi,

First of all just a BIG +1 to this issue. I'm on windows and opening git-gui sometimes literally hurts my eyes. I even noticed I've started squinting a little before opening it, then I move it to my side monitor and open my IDE (which ofc is dark theme) on my main.

> Here is the preview I said: https://pasteboard.co/rwUBvWbX6m66.png .
> The checkbox needs some tinkering.
> Looking forward to any suggestions.

I would really appreciate it if you could help me make my git-gui look like this. What do I need to do, exactly?

Best regards, Birger

Sashank Bandi· Dec 21, 2021, 16:14 UTC · re: Birger Skogeng Pedersen · lore
Show 6 quoted lines
> > Here is the preview I said: https://pasteboard.co/rwUBvWbX6m66.png .
> > The checkbox needs some tinkering.
> > Looking forward to any suggestions.
>
> I would really appreciate it if you could help me make my git-gui look
> like this. What do I need to do, exactly?

It's really good to know that there are people interested in this. But I am sorry to say that my work on it is temporarily stopped as I cannot figure out a way to make the top caption bar of a window black on Windows. I am trying workarounds in C++ by disabling DWM, but they don't seem to work. There is a hidden unpublished API in Windows 10 and 11. But I would like to instead make it work for all OSes starting from Windows 7 at least.

But, I have the code that will make the screenshot possible.
Simply put:
1. Press Win + R
2. Enter "git-gui.exe --trace" and press Enter
3. Paste the following code(indented for clarity) in the console
window(a white window with red and black text) that appears.
    ttk::style theme use default
    ttk::style configure TFrame -background #333
    ttk::style configure TLabelframe -background #333
    ttk::style configure TLabelframe.Label -background #333 -foreground #fff
    ttk::style configure TPanedwindow  -background #333
    ttk::style configure EntryFrame -background #333
    ttk::style configure TScrollbar -background #666 -troughcolor #444
-arrowcolor #fff -arrowsize 15
    ttk::style map TScrollbar -background \
        [list active #333 disabled #000]
    ttk::style configure TLabel -background #333 -foreground #fff
    ttk::style configure TButton -background #333 -foreground #fff
-borderwidth 2 -bordercolor #fff
    ttk::style map TButton -background \
        [list active #555 disabled #111 readonly #000]
    ttk::style configure TCheckbutton -background #333 -foreground
#fff -indicatorbackground #666 -indicatorcolor #fff
    ttk::style map TCheckbutton -background \
        [list active #555 disabled #111 readonly #000]
    ttk::style configure TEntry -fieldbackground #333 -background #333
-foreground #fff -insertcolor #fff
    ttk::style configure TRadiobutton -background #333 -foreground #fff
    ttk::style map TRadiobutton -background \
        [list active #555 disabled #111 readonly #000]
    option add *TCombobox*Listbox.background #333 interactive
    option add *TCombobox*Listbox.foreground #fff interactive
    option add *TCombobox*Listbox.selectBackground blue interactive
    option add *TCombobox*Listbox.selectForeground #fff interactive
    option add *Listbox.Background #333 interactive
    option add *Listbox.Foreground #fff interactive
    option add *Text.Background #333 interactive
    option add *Text.Foreground #fff interactive
    ttk::style configure TSpinbox -fieldbackground #333 -background
#333 -foreground #fff -insertcolor #fff -arrowcolor #fff
    .vpane.lower.commarea.buffer.frame.t configure -background #0d1117
-foreground #fff -insertbackground #fff
    .vpane.lower.diff.body.t configure -background #0d1117 -foreground #fff
    .vpane.files.workdir.list configure -background #0d1117 -foreground #fff
    .vpane.files.index.list configure -background #0d1117 -foreground #fff
    .about_dialog.git_logo configure -background #333
4. Enjoy Git GUI.

If you get "git-gui.exe: command not found", it implies that the exe for Git GUI isn't installed in your path. Then you should manually find the path to the exe(mostly will be in "C:\Program Files\Git\cmd") and execute it in Win + R prompt as "C:\Program Files\Git\cmd\git-gui.exe --trace" and then press Enter. Then enter the code.

The code I provided also changes some of the Tcl/Tk core defaults for maximum dark mode effect. So, it isn't possible to revert to light mode on the run. Closing and reopening all the Git GUI windows will revert it back. I did not test a location for the persistence of dark mode, I will dig deeper into the TCL soon. You should execute the code at the start of the Git GUI for it to work perfectly.

Preview for "Create Branch": [0] "Checkout Branch": [1] "Options": [2]

[0]: https://pasteboard.co/PVXqzigC1Hvs.png [1]: https://pasteboard.co/MRjlQ23ldVKO.png [2]: https://pasteboard.co/HalaJ8Rw1BDU.png

Birger Skogeng Pedersen· Jan 17, 2022, 14:33 UTC · re: Sashank Bandi · lore

Thanks a lot for trying to help me, Sashank. There seems to be an issue with the code. I had to take a little guess at where the actual line breaks should be, maybe I messed up?

I pasted the code here: https://github.com/prati0100/git-gui/issues/64
Can you take a look?

Best regards, Birger

Birger Skogeng Pedersen· Jan 17, 2022, 14:40 UTC · re: Birger Skogeng Pedersen · lore
Hi again,
I think I found the problem. Should be okay now.
Thanks, again

On Mon, Jan 17, 2022 at 3:33 PM Birger Skogeng Pedersen <birger.sp@gmail.com> wrote:

Show 11 quoted lines
>
> Thanks a lot for trying to help me, Sashank. There seems to be an
> issue with the code. I had to take a little guess at where the actual
> line breaks should be, maybe I messed up?
>
> I pasted the code here: https://github.com/prati0100/git-gui/issues/64
>
> Can you take a look?
>
> Best regards,
> Birger

← back to recent threads