GithubHelp home page GithubHelp logo

Change the background colour about git-gui HOT 14 OPEN

prati0100 avatar prati0100 commented on June 15, 2024
Change the background colour

from git-gui.

Comments (14)

prati0100 avatar prati0100 commented on June 15, 2024 1

I tried using your 2nd point and it seemed to have no effect, or barely any effect, and not on those colors.

Huh... That should not happen and is certainly a bug. I have some suspicion what is going wrong.

Anyway, seeing how many people are struggling with theming I think it is a good idea to add a theme selector for git-gui. Other Tk application be damned, we can at least make theming easy for our users.

from git-gui.

MaxLap avatar MaxLap commented on June 15, 2024

I have also just did update, which brought me to git 2.29 and git-gui git-gui version 0.21.0.78.g38c2a.

I instantly noticed a change to both background and font color. The color don't match what you describe, but the issue is likely the same. I am also on Ubuntu MATE (but using 16.04).

The readability of all text (in all 4 quadrants) has been worsened. Basically: The background is no longer white, is more of a grayish, and the text is now much lighter (used to be basically black).

image

This makes the contrast a lot lower and makes it noticeably harder to read anything.

Any help would be very appreciated

from git-gui.

prati0100 avatar prati0100 commented on June 15, 2024

Cc @last-partizan

@rdiez @MaxLap git-gui recently got better theming support. The background colors are the ones from the default Tk theme. Unfortunately it looks like the defaults are not very good because I have seen multiple reports about this.

You have two options to fix this:

  1. Pick a better Tk theme. Tk theming is a bit arcane to work with. Check this discussion to get more info on how you can customize your Tk theme.
  2. Disable theming completely. This can be done by setting the option gui.usettk to 0 via git config. For example, to disable it for all repos, you would do something like: git config --global gui.usettk 0.

I am closing this issue for now because it really is not our fault some distros use weird default themes (things look sane on my Arch installation). Please feel free to repoen it if the above two options don't work for you.

from git-gui.

MaxLap avatar MaxLap commented on June 15, 2024

Thanks for the quick feedback.

I tried using your 2nd point and it seemed to have no effect, or barely any effect, and not on those colors.

I also tried tweaking the theming as your 1st point mention, but I had to have super generic rules such as *background and *foreground, which clearly broke too many thing.

It's like I had a default theming customization, so even changing theme wouldn't fix the problem.

I found this post: https://superuser.com/a/1351752, which explains that Ubuntu MATE as a weird default theme which is actually applied after user themes...

Anyways, disabling as the post explains that bought back the colors I expected. From the post:

So dconf-editor finds org.mate.SettingsDaemon.plugins.xrdb with the attribute active setting this to false fixes the issue.

image

Feels so much better!

from git-gui.

rdiez avatar rdiez commented on June 15, 2024

I can confirm that "git config --global gui.usettk 0" has no effect on my computer either.

from git-gui.

last-partizan avatar last-partizan commented on June 15, 2024

@rdiez and this is really strange.

Please try to put this into ~/.Xresources:

*TkTheme: default
*Text.Background: white

And use xrdb -merge ~/.Xresources to apply it.

Now text should be white:

image

from git-gui.

rdiez avatar rdiez commented on June 15, 2024

I tried the fix linked by MaxLap above, and it worked. This is the command I used:

gsettings set org.mate.SettingsDaemon.plugins.xrdb active false

That change works after loging off and on again. On my system, that gave me the usual white background colour.

In order to undo the change, I issued the following command:

gsettings reset org.mate.SettingsDaemon.plugins.xrdb active

Without that change, what you suggest with ~/.Xresources does not work on Ubuntu MATE 20.04. With that change in place, it does work. For example, you can change the background colour to pink with a ~/.Xresources file like this:

*TkTheme: default
*Text.Background: pink

The trouble is, command xrdb -merge ~/.Xresources integrates those settings into some "X server resource database", and I could not find in the documentation a way to revert that database to default values. Who knows if manually setting *Text.Background will create some trouble in the future, or in other Tk applications.

So my advice would be not to use ~/.Xresources unless you really do not like the default colour that disabling org.mate.SettingsDaemon.plugins.xrdb yields. And then it is perhaps a good idea to try another *TkTheme before manually setting some colours.

Alas, it is not easy to find out what Tk themes are available: "The ability to retrieve a list of all currently available styles is currently not supported.". See https://tip.tcl.tk/584 .

This is all too much work for most of us. It would be nice if git-gui had an option, or a command-line argument, to list all Tk themes available, and to specify the Tk theme to use. Another option would be to provide an option, or a command-line argument, to specify the background colour to use. With such options, it would be much easier to avoid hard-to-read colour combinations that result from strange Linux distros and/or strange Tk settings.

from git-gui.

last-partizan avatar last-partizan commented on June 15, 2024

I just loaded Ubuntu Mate 20.04 into virtual machine, and i'm looking at:

> xrdb -query  | grep Text
...
*Text.background:	#f2f1f0
*Text.foreground:	#4c4c4c

And this is exactly what causing this issues. Git-gui instead of hardcoded white/dark colors now respects what current theme suggests, and it suggests this.

I'ts even not a theme, it's just preconfigured Xresources, so changing tk theme would not help. git-gui tries to get options from theme, but ubuntu overrides it with forced values.

> grep Text.background /etc/X11/ -R
/etc/X11/app-defaults/Editres-color:*Text.background:		rgb:29/44/94
/etc/X11/app-defaults/Xedit-color:*Text*Text.background:		gray96
/etc/X11/app-defaults/Xedit-color:*Text.background:		gray96
/etc/X11/app-defaults/Xmessage-color:*Text*background:		gray96

Looks like Ubuntu just merges all this into Xresources database, and, because none of the files specifies app name (like appname*Text.background), it is expected that this would set text for every app (git-gui included).

As a workaround, setting color in ~/.Xresources is just fine. Use format git-citool*Text.background: #fff so it would not conflict with other apps.

The trouble is, command xrdb -merge ~/.Xresources integrates those settings into some "X server resource database"

To revert it - just remove that file and relogin. At login this database is populated from app-defaults + ~/.Xresources.

Proper solution is this case: report it to Ubuntu, so they would fix wildcard options in app-defaults.

Adding options or command line arguments in git-gui to fix issues caused by other things is not good solution.


@prati0100 maybe you can suggest other solution. Maybe there is a way change this:

option add *Text.background $text_bg widgetDefault

to something without wildcard, like git-citool*Text.background, but i can't make it work this way.

We can change priority from widgetDefault to interactive, but this would disable any way to override this option. So i don't see other solutions.

from git-gui.

rdiez avatar rdiez commented on June 15, 2024

Thanks for the information. It is not easy to find this kind of details in the documentation of Tk or xrdb.

I can imagine that a user may want to change the colour of some element in git-gui, just like in any other application. May I suggest adding a section about this in the man page?

Otherwise, how is the user supposed to know that the Tk application name is "git-citool"? I would have thought it would be "git gui" or "git-gui". A section like the following would help prevent frustration:

----8<----8<----8<----
TK CONFIGURATION

The application name for Tk configuration purposes is "git-citool". For example, in order to change the text background colour, add to your ~/.Xresources file the following line:

git-citool*Text.background: #fff

And then issue the following command, in order to avoid having to relogin:

xrdb -merge ~/.Xresources
----8<----8<----8<----

That's enough information to satisfy the most common requirement, and it provides some hints for anybody to search the Internet for more information if they wish. Note that it does not even mention the specific issues with Ubuntu MATE: it is just basic information to help configure git-gui without having to be an expert in X Windows or Tk.

I am a (small) open source developer myself, and I try to help my users wherever I can. For extra karma points:

----8<----8<----8<----
It has been reported that Ubuntu MATE 16.04-20.04 modifies some Tk settings in a way that prevents the Tk theme from working properly. A workaround is to disable this behaviour with:

gsettings set org.mate.SettingsDaemon.plugins.xrdb active false
----8<----8<----8<----

from git-gui.

rdiez avatar rdiez commented on June 15, 2024

I recently upgraded my Ubuntu MATE system from version 20.04 to 22.04, and I started having trouble with the colours again.

After the upgrade, the Theme was set to "customized", which I do not remember doing myself.
So I changed the theme to Menta, which has worked well in the past.
Git Gui was now showing the gray text background again. Therefore, I issued this command:

gsettings set org.mate.SettingsDaemon.plugins.xrdb active false

After logging out and in again, the text background was white. But now I couldn't see the highlighting anymore when I selected text with the mouse.

I created file ~/.Xresources with the following content:

git-gui*Text.selectBackground: lightgray

Note that the Tk resource name prefix has apparently changed from 'git-citool' to 'git-gui'.
I am using git-gui version 0.21.0.99.gdf4f9e .

I then issued this command:

xrdb -merge ~/.Xresources

And the text selection colour was OK afterwards.

I still do not know why Ubuntu, or maybe only Ubuntu MATE, is setting the Tk colours like that.

from git-gui.

MaxLap avatar MaxLap commented on June 15, 2024

Hello, for 22.04, I first tried with a clean Ubuntu MATE install and had the same problems you mention. Not being familiar with these resources files, i flailed around for a while. I fixed the Text color part, but couldn't figure out the highlight part.

I ended up switching to regular Ubuntu because of many papercuts including this one and had no issue with git-gui on Ubuntu. So I would blame MATE.

Thanks for posting your fixes, if I switch back, they will useful I'm sure.

from git-gui.

rdiez avatar rdiez commented on June 15, 2024

I just realised that the text foreground colour was not really black, but some gray (*Text.foreground: #3d3d3d). I thought that the monitor had gone blurry, or that my eyes were tired. These are the settings I am using now, to be sure (at least for Git Gui):

git-gui*Text.background: white
git-gui*Text.foreground: black
git-gui*Text.selectBackground: lightgray

from git-gui.

rdiez avatar rdiez commented on June 15, 2024

One more thing I have noticed: you probably want to set Text.inactiveSelectBackground to the same value as Text.selectBackground, so:

git-gui*Text.inactiveSelectBackground: lightgray

from git-gui.

rdiez avatar rdiez commented on June 15, 2024

In the meantime, I have realised that Emacs (when configured to use GTK 3, which is the default on my distribution) has similar text colour problems.

I have also discovered that switching to Theme Clearlooks-Phénix (package clearlooks-phenix-theme) on my Ubuntu MATE 22.04.1 system fixes the colour problems in Emacs and it Git Gui without any workarounds in ~/.Xresources.

But I have changed a lot of things on my system while testing this kind of problem. Can somebody else confirm that switching to Clearlooks-Phénix fixes the issue?

from git-gui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.