git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Pratyush Yadav <me@yadavpratyush.com>
To: Sashank Bandi <bandi.rao999@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Bagas Sanjaya <bagasdotme@gmail.com>,
	David Aguilar <davvid@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [INFO] Does Git GUI support Dark Mode on Windows 10 ?
Date: Wed, 6 Oct 2021 23:33:48 +0530	[thread overview]
Message-ID: <20211006180348.22e5c2z4pqkwtokx@yadavpratyush.com> (raw)
In-Reply-To: <CABkJDHFap2DmjMr1Ri-Mrud+msChB3uEGRKYyczAxfmaLnF6jA@mail.gmail.com>

On 06/10/21 08:15PM, Sashank Bandi wrote:
> > 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.

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

  reply	other threads:[~2021-10-06 18:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 15:09 [INFO] Does Git GUI support Dark Mode on Windows 10 ? Sashank Bandi
2021-09-27  6:32 ` Bagas Sanjaya
2021-09-27 10:19   ` Sashank Bandi
2021-09-27 10:39     ` Bagas Sanjaya
2021-09-27 10:51       ` Sashank Bandi
2021-09-27 18:08       ` David Aguilar
2021-09-28  3:21         ` Sashank Bandi
2021-10-03 14:33           ` Sashank Bandi
2021-10-04  3:29             ` Bagas Sanjaya
2021-10-04  7:56             ` Pratyush Yadav
2021-10-04 15:09               ` Sashank Bandi
2021-10-06 11:39                 ` Pratyush Yadav
2021-10-06 14:45                   ` Sashank Bandi
2021-10-06 18:03                     ` Pratyush Yadav [this message]
2021-10-07 11:27                       ` Sashank Bandi
  -- strict thread matches above, loose matches on Subject: below --
2021-12-08 12:29 Birger Skogeng Pedersen
2021-12-13  8:03 Birger Skogeng Pedersen
2021-12-21 16:14 ` Sashank Bandi
2022-01-17 14:33   ` Birger Skogeng Pedersen
2022-01-17 14:40     ` Birger Skogeng Pedersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211006180348.22e5c2z4pqkwtokx@yadavpratyush.com \
    --to=me@yadavpratyush.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=bagasdotme@gmail.com \
    --cc=bandi.rao999@gmail.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).