git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/1] git-gui: fix colored label backgrounds on Mac
@ 2020-11-22 19:45 Stefan Haller
  2020-11-22 19:45 ` [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets Stefan Haller
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Haller @ 2020-11-22 19:45 UTC (permalink / raw)
  To: me; +Cc: git

Here's another attempt at fixing the colored label backgrounds when using themed
widgets on Mac. I sent a different approach a few weeks ago, which was to make
the gui.usettk option default to off on Mac. This was clearly not a good
solution. This time I'm presenting an approach that is a little less drastic;
it's still not ideal, but I feel it's an acceptable compromise.

Another problem that is improved by this is dark mode on Mac: in that mode the
label text was almost invisible, because it was black on a very dark grey
background.

Stefan Haller (1):
  git-gui: fix colored label backgrounds when using themed widgets

 lib/themed.tcl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.29.0.18.gf8c967e53c


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets
  2020-11-22 19:45 [PATCH 0/1] git-gui: fix colored label backgrounds on Mac Stefan Haller
@ 2020-11-22 19:45 ` Stefan Haller
  2020-12-01 20:06   ` Pratyush Yadav
  2020-12-17 19:03   ` Pratyush Yadav
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Haller @ 2020-11-22 19:45 UTC (permalink / raw)
  To: me; +Cc: git

The aqua theme on Mac doesn't support changing the background color for labels
and frames [1]. Since the red, green, and yellow backgrounds of the labels for
unstaged and staged files and the diff pane are so important design elements of
git gui's main window, it's not acceptable for them to have grey backgrounds on
Mac.

To work around this, simply use non-themed widgets for all labels on Mac. This
is not a big problem because labels don't look extremely different between the
themed and non-themed versions. There are subtle differences, but they are not
as bad as having the wrong background color.

[1] https://stackoverflow.com/a/6723911

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
---
 lib/themed.tcl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/themed.tcl b/lib/themed.tcl
index 83e3ac7..02aae90 100644
--- a/lib/themed.tcl
+++ b/lib/themed.tcl
@@ -174,7 +174,7 @@ proc InitEntryFrame {} {

 proc gold_frame {w args} {
 	global use_ttk
-	if {$use_ttk} {
+	if {$use_ttk && ![is_MacOSX]} {
 		eval [linsert $args 0 ttk::frame $w -style Gold.TFrame]
 	} else {
 		eval [linsert $args 0 frame $w -background gold]
@@ -183,7 +183,7 @@ proc gold_frame {w args} {

 proc tlabel {w args} {
 	global use_ttk
-	if {$use_ttk} {
+	if {$use_ttk && ![is_MacOSX]} {
 		set cmd [list ttk::label $w -style Color.TLabel]
 		foreach {k v} $args {
 			switch -glob -- $k {
--
2.29.0.18.gf8c967e53c


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets
  2020-11-22 19:45 ` [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets Stefan Haller
@ 2020-12-01 20:06   ` Pratyush Yadav
  2020-12-02  8:52     ` Stefan Haller
  2020-12-17 19:03   ` Pratyush Yadav
  1 sibling, 1 reply; 7+ messages in thread
From: Pratyush Yadav @ 2020-12-01 20:06 UTC (permalink / raw)
  To: Stefan Haller; +Cc: git

Hi Stefan,

Thanks for the patch.

On 22/11/20 08:45PM, Stefan Haller wrote:
> The aqua theme on Mac doesn't support changing the background color for labels
> and frames [1]. Since the red, green, and yellow backgrounds of the labels for
> unstaged and staged files and the diff pane are so important design elements of
> git gui's main window, it's not acceptable for them to have grey backgrounds on
> Mac.

I unfortunately don't have access to a Mac machine to I can't test this 
patch.

Were the colors fine before c02efc1 (git-gui: improve dark mode support, 
2020-09-26)? From what I understand that patch should not affect the 
colors of the "Staged Changes" or the "Unstaged Changes" parts.

If the colors were fine earlier then we need to figure out why colors 
from the theme are being used even when we hard-code green or red when 
creating those labels.

Can you give it a try on a commit before c02efc1 and see what happens?
 
> To work around this, simply use non-themed widgets for all labels on Mac. This
> is not a big problem because labels don't look extremely different between the
> themed and non-themed versions. There are subtle differences, but they are not
> as bad as having the wrong background color.

Agreed. Though I certainly wish we didn't have to do this.
 
> [1] https://stackoverflow.com/a/6723911
> 
> Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
> ---
>  lib/themed.tcl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/themed.tcl b/lib/themed.tcl
> index 83e3ac7..02aae90 100644
> --- a/lib/themed.tcl
> +++ b/lib/themed.tcl
> @@ -174,7 +174,7 @@ proc InitEntryFrame {} {
> 
>  proc gold_frame {w args} {
>  	global use_ttk
> -	if {$use_ttk} {
> +	if {$use_ttk && ![is_MacOSX]} {
>  		eval [linsert $args 0 ttk::frame $w -style Gold.TFrame]
>  	} else {
>  		eval [linsert $args 0 frame $w -background gold]
> @@ -183,7 +183,7 @@ proc gold_frame {w args} {
> 
>  proc tlabel {w args} {
>  	global use_ttk
> -	if {$use_ttk} {
> +	if {$use_ttk && ![is_MacOSX]} {
>  		set cmd [list ttk::label $w -style Color.TLabel]
>  		foreach {k v} $args {
>  			switch -glob -- $k {

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets
  2020-12-01 20:06   ` Pratyush Yadav
@ 2020-12-02  8:52     ` Stefan Haller
  2020-12-06 13:07       ` Pratyush Yadav
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Haller @ 2020-12-02  8:52 UTC (permalink / raw)
  To: Pratyush Yadav; +Cc: git

On 01.12.20 21:06, Pratyush Yadav wrote:
> Hi Stefan,
> 
> Thanks for the patch.
> 
> On 22/11/20 08:45PM, Stefan Haller wrote:
>> The aqua theme on Mac doesn't support changing the background color for labels
>> and frames [1]. Since the red, green, and yellow backgrounds of the labels for
>> unstaged and staged files and the diff pane are so important design elements of
>> git gui's main window, it's not acceptable for them to have grey backgrounds on
>> Mac.
> 
> I unfortunately don't have access to a Mac machine to I can't test this 
> patch.

I could send screenshots if that helps.

> Were the colors fine before c02efc1 (git-gui: improve dark mode support, 
> 2020-09-26)? From what I understand that patch should not affect the 
> colors of the "Staged Changes" or the "Unstaged Changes" parts.
> 
> If the colors were fine earlier then we need to figure out why colors 
> from the theme are being used even when we hard-code green or red when 
> creating those labels.
> 
> Can you give it a try on a commit before c02efc1 and see what happens?

No, the colors were wrong on Mac for the past ten years, all the way
back to when ttk widgets were introduced in c80d7be5e1 ("git-gui: use
themed tk widgets with Tk 8.5", 2010-01-26).

It is simply not possible to change the background color of a ttk button
or label on Mac; c02efc1 doesn't have anything to do with this.

-Stefan


>> To work around this, simply use non-themed widgets for all labels on Mac. This
>> is not a big problem because labels don't look extremely different between the
>> themed and non-themed versions. There are subtle differences, but they are not
>> as bad as having the wrong background color.
> 
> Agreed. Though I certainly wish we didn't have to do this.
>  
>> [1] https://stackoverflow.com/a/6723911
>>
>> Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
>> ---
>>  lib/themed.tcl | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/themed.tcl b/lib/themed.tcl
>> index 83e3ac7..02aae90 100644
>> --- a/lib/themed.tcl
>> +++ b/lib/themed.tcl
>> @@ -174,7 +174,7 @@ proc InitEntryFrame {} {
>>
>>  proc gold_frame {w args} {
>>  	global use_ttk
>> -	if {$use_ttk} {
>> +	if {$use_ttk && ![is_MacOSX]} {
>>  		eval [linsert $args 0 ttk::frame $w -style Gold.TFrame]
>>  	} else {
>>  		eval [linsert $args 0 frame $w -background gold]
>> @@ -183,7 +183,7 @@ proc gold_frame {w args} {
>>
>>  proc tlabel {w args} {
>>  	global use_ttk
>> -	if {$use_ttk} {
>> +	if {$use_ttk && ![is_MacOSX]} {
>>  		set cmd [list ttk::label $w -style Color.TLabel]
>>  		foreach {k v} $args {
>>  			switch -glob -- $k {
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets
  2020-12-02  8:52     ` Stefan Haller
@ 2020-12-06 13:07       ` Pratyush Yadav
  2020-12-08 15:20         ` Stefan Haller
  0 siblings, 1 reply; 7+ messages in thread
From: Pratyush Yadav @ 2020-12-06 13:07 UTC (permalink / raw)
  To: Stefan Haller; +Cc: git

On 02/12/20 09:52AM, Stefan Haller wrote:
> On 01.12.20 21:06, Pratyush Yadav wrote:
> > Hi Stefan,
> > 
> > Thanks for the patch.
> > 
> > On 22/11/20 08:45PM, Stefan Haller wrote:
> >> The aqua theme on Mac doesn't support changing the background color for labels
> >> and frames [1]. Since the red, green, and yellow backgrounds of the labels for
> >> unstaged and staged files and the diff pane are so important design elements of
> >> git gui's main window, it's not acceptable for them to have grey backgrounds on
> >> Mac.
> > 
> > I unfortunately don't have access to a Mac machine to I can't test this 
> > patch.
> 
> I could send screenshots if that helps.

Yes, that would be helpful.
 
> > Were the colors fine before c02efc1 (git-gui: improve dark mode support, 
> > 2020-09-26)? From what I understand that patch should not affect the 
> > colors of the "Staged Changes" or the "Unstaged Changes" parts.
> > 
> > If the colors were fine earlier then we need to figure out why colors 
> > from the theme are being used even when we hard-code green or red when 
> > creating those labels.
> > 
> > Can you give it a try on a commit before c02efc1 and see what happens?
> 
> No, the colors were wrong on Mac for the past ten years, all the way
> back to when ttk widgets were introduced in c80d7be5e1 ("git-gui: use
> themed tk widgets with Tk 8.5", 2010-01-26).
> 
> It is simply not possible to change the background color of a ttk button
> or label on Mac; c02efc1 doesn't have anything to do with this.

Ok. Thanks for the clarification. Will apply the patch.
 
> -Stefan
> 
> 
> >> To work around this, simply use non-themed widgets for all labels on Mac. This
> >> is not a big problem because labels don't look extremely different between the
> >> themed and non-themed versions. There are subtle differences, but they are not
> >> as bad as having the wrong background color.
> > 
> > Agreed. Though I certainly wish we didn't have to do this.
> >  
> >> [1] https://stackoverflow.com/a/6723911
> >>
> >> Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
> >> ---
> >>  lib/themed.tcl | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/lib/themed.tcl b/lib/themed.tcl
> >> index 83e3ac7..02aae90 100644
> >> --- a/lib/themed.tcl
> >> +++ b/lib/themed.tcl
> >> @@ -174,7 +174,7 @@ proc InitEntryFrame {} {
> >>
> >>  proc gold_frame {w args} {
> >>  	global use_ttk
> >> -	if {$use_ttk} {
> >> +	if {$use_ttk && ![is_MacOSX]} {
> >>  		eval [linsert $args 0 ttk::frame $w -style Gold.TFrame]
> >>  	} else {
> >>  		eval [linsert $args 0 frame $w -background gold]
> >> @@ -183,7 +183,7 @@ proc gold_frame {w args} {
> >>
> >>  proc tlabel {w args} {
> >>  	global use_ttk
> >> -	if {$use_ttk} {
> >> +	if {$use_ttk && ![is_MacOSX]} {
> >>  		set cmd [list ttk::label $w -style Color.TLabel]
> >>  		foreach {k v} $args {
> >>  			switch -glob -- $k {
> > 

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets
  2020-12-06 13:07       ` Pratyush Yadav
@ 2020-12-08 15:20         ` Stefan Haller
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Haller @ 2020-12-08 15:20 UTC (permalink / raw)
  To: Pratyush Yadav; +Cc: git

On 06.12.20 14:07, Pratyush Yadav wrote:
> On 02/12/20 09:52AM, Stefan Haller wrote:
>> On 01.12.20 21:06, Pratyush Yadav wrote:
>>> Hi Stefan,
>>>
>>> Thanks for the patch.
>>>
>>> On 22/11/20 08:45PM, Stefan Haller wrote:
>>>> The aqua theme on Mac doesn't support changing the background color for labels
>>>> and frames [1]. Since the red, green, and yellow backgrounds of the labels for
>>>> unstaged and staged files and the diff pane are so important design elements of
>>>> git gui's main window, it's not acceptable for them to have grey backgrounds on
>>>> Mac.
>>>
>>> I unfortunately don't have access to a Mac machine to I can't test this 
>>> patch.
>>
>> I could send screenshots if that helps.
> 
> Yes, that would be helpful.

Here are some screenshots; with and without the patch, with and without
ttk, and in light mode and dark mode.

   https://cp.sync.com/dl/1cf0e2cd0/dynix3qc-ev5q8crr-sp2kjxuy-h4pcwr68

-Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets
  2020-11-22 19:45 ` [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets Stefan Haller
  2020-12-01 20:06   ` Pratyush Yadav
@ 2020-12-17 19:03   ` Pratyush Yadav
  1 sibling, 0 replies; 7+ messages in thread
From: Pratyush Yadav @ 2020-12-17 19:03 UTC (permalink / raw)
  To: Stefan Haller; +Cc: git

On 22/11/20 08:45PM, Stefan Haller wrote:
> The aqua theme on Mac doesn't support changing the background color for labels
> and frames [1]. Since the red, green, and yellow backgrounds of the labels for
> unstaged and staged files and the diff pane are so important design elements of
> git gui's main window, it's not acceptable for them to have grey backgrounds on
> Mac.
> 
> To work around this, simply use non-themed widgets for all labels on Mac. This
> is not a big problem because labels don't look extremely different between the
> themed and non-themed versions. There are subtle differences, but they are not
> as bad as having the wrong background color.
> 
> [1] https://stackoverflow.com/a/6723911
> 
> Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
> ---
>  lib/themed.tcl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to git-gui/master. Thanks.

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-17 19:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-22 19:45 [PATCH 0/1] git-gui: fix colored label backgrounds on Mac Stefan Haller
2020-11-22 19:45 ` [PATCH 1/1] git-gui: fix colored label backgrounds when using themed widgets Stefan Haller
2020-12-01 20:06   ` Pratyush Yadav
2020-12-02  8:52     ` Stefan Haller
2020-12-06 13:07       ` Pratyush Yadav
2020-12-08 15:20         ` Stefan Haller
2020-12-17 19:03   ` Pratyush Yadav

Code repositories for project(s) associated with this 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).