From: serg.partizan@gmail.com Date: Sun, 22 Nov 2020 17:16:25 GMT Subject: Re: [PATCH] git-gui: Fix selected text colors Message-ID: In-Reply-To: <2436cd2e-26b9-a7cc-722a-7f27212f58f4@haller-berlin.de> On Sun, Nov 22, 2020 at 16:41, Stefan Haller wrote: > Preserving the previous behavior is probably a good idea when fixing a > regression. > > However, it would actually be nice to have different colors for active > and inactive selection (could be a follow-up patch). In native Mac and > Windows applications the active selection background is usually light > blue, and the inactive one is light grey. This would not just be a > cosmetic improvement that looks prettier (that wouldn't be worth it), > but it would be a real usability improvement because it would make it > much easier to tell which of the four main views has the keyboard > focus. > > I couldn't find a way to query the inactive selection colors, though. > Do > you know if there's a way to do that? If not, I guess one way to do > this > is to numerically calculate a grey color with a similar brightness > from > the active selection background. I could work on a patch if you think > this is an approach that makes sense. I'm using this code in `wish` to query widget for available options: > text .t > .t configure And it shows this widget has `-inactiveselectbackground` option. However, it doesn't have `-inactiveselectforeground` as I was thinking in previous patch. > .t configure -inactiveselectbackground -inactiveselectbackground inactiveSelectBackground Foreground #c3c3c3 #c3c3c3 But I have no idea how to get this colors from ttk::style. Looking at awdark theme, it set's inactiveselectbackground in function setTextColors, which is used on text widget directly. And we cannot use it here. I think calculating that gray color from current selection bg is too much work for just one color. We can just set inactiveSelectBackground to some neutral gray color like #707070 or #909090 which will work fine with both dark and light themes. And, because we're using "widgetDefault" priority - themes can override this, when they want to explicitly set this color.