Setting GTK colors for Claws Mail  [Solved]

Message
Author
linuxbobtas
Posts: 19
Joined: Sat Nov 23, 2019 11:11 pm

Setting GTK colors for Claws Mail

#1 Post by linuxbobtas »

How to modify the GTK colors for Claws Mail 4.1.1? The releases page [https://www.claws-mail.org/releases.php] says the "4" series releases are built with GTK+ 3, but I can't modify the "view" colors in ~/.config/gtk-3.0/gtk.css, as I can with (for example) Thunar:

/*set custom gtk3/css code below */
.thunar .view:selected { background-color: #e6e6dc; color: black; }

By default Thunar changes the font color for selected items in a Thunar window from black to white, and adds a bright blue background. The above modification keeps the selected item font black and changes the background to a straw color.

I'd really like to change the Claws Mail colors, because selected items are that bright blue and the font color remains black. This is hard to read - the contrast is too low.

Suggestions welcome!

-----------------
System:
Kernel: 6.4.0-1mx-ahs-amd64 [6.4.4-1~mx23+1] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
parameters: BOOT_IMAGE=/boot/vmlinuz-6.4.0-1mx-ahs-amd64 root=UUID=<filter> ro quiet
Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 info: xfce4-panel wm: xfwm v: 4.18.0 vt: 7
dm: LightDM v: 1.26.0 Distro: MX-23.2_ahs_x64 Libretto July 31 2023 base: Debian GNU/Linux 12
(bookworm)

User avatar
fehlix
Developer
Posts: 12704
Joined: Wed Apr 11, 2018 5:09 pm

Re: Setting GTK colors for Claws Mail

#2 Post by fehlix »

linuxbobtas wrote: Tue Apr 30, 2024 5:14 am I'd really like to change the Claws Mail colors, because selected items are that bright blue and the font color remains black. This is hard to read - the contrast is too low.
Not sure what "selected items" means, maybe it depends on theme in use.
Works here as it should be in both dark and light themes:
Light theme mx-comfort:
claws-mail-light.jpg
Dark theme mx-comfort-dark:
claws-mail-dark.jpg
You may want to restart claws-mail after changing theme.
You do not have the required permissions to view the files attached to this post.

linuxbobtas
Posts: 19
Joined: Sat Nov 23, 2019 11:11 pm

Re: Setting GTK colors for Claws Mail

#3 Post by linuxbobtas »

@fehlix, many thanks. In your screenshots the selected message has the font changed from black to white and there is a blue background. What I am looking for is a way to change these colors in Claws Mail only, not a system-wide change in the theme. I can do this with Thunar, but not Claws Mail.

I attach a screenshot showing what I see in Claws Mail with my current GTK theme.
Image

Please note that there is no way to change these colors in clawsrc, or in the nice GUI for configuration changes, Clawsker [https://www.claws-mail.org/clawsker.php].

User avatar
fehlix
Developer
Posts: 12704
Joined: Wed Apr 11, 2018 5:09 pm

Re: Setting GTK colors for Claws Mail

#4 Post by fehlix »

linuxbobtas wrote: Tue Apr 30, 2024 4:00 pm @fehlix, many thanks. In your screenshots the selected message has the font changed from black to white and there is a blue background. What I am looking for is a way to change these colors in Claws Mail only, not a system-wide change in the theme. I can do this with Thunar, but not Claws Mail.

I attach a screenshot showing what I see in Claws Mail with my current GTK theme.
I've only switched between mx-comfort and mx-comfort-dark theme to check those with claws-mail,
and both seems to work as shown in the the screen capture.
The old trick to switch theme for an app with GTK_THEME=
seems still working:
E.g., when started this way:

Code: Select all

env GTK_THEME=mx-comfort-dark claws-mail
or

Code: Select all

env GTK_THEME=mx-comfort claws-mail

linuxbobtas
Posts: 19
Joined: Sat Nov 23, 2019 11:11 pm

Re: Setting GTK colors for Claws Mail

#5 Post by linuxbobtas »

@fehlix, thanks again. Yes, changing theme also works for me and selected messages and folders are background=blue, text=white with (for example) mx-comfort. Do you know a way to change those colors application by application, other than with the ~/.config/gtk-3.0/gtk.css hack I mentioned in my original post?

I attach a screenshot showing what ".thunar .view:selected { background-color: #e6e6dc; color: black; }" does. Maybe Claws Mail has another way of setting colors, or the CSS class for Claws Mail is defined some other way (I tried many different class definitions).


Image

User avatar
Melber
Developer
Posts: 1308
Joined: Tue Mar 23, 2021 4:19 pm

Re: Setting GTK colors for Claws Mail  [Solved]

#6 Post by Melber »

@linuxbobtas
Try adding/editing the following lines in the gtk-3.0/gtk.css file for your selected theme.


This should change the text color and highlight background for the email list in the right pane.
(Replace the red and yellow with the hex color codes of your choice.)

Code: Select all

#mainwindow #summaryview_sctree:selected {color: red; background-color: yellow; }

This should change the background for the selected folder in the left pane. (Haven't figured out how to change the text color here.)

Code: Select all

.gtkstyle-fallback:selected {background-color: yellow; }

nb: These settings may also affect other apps

linuxbobtas
Posts: 19
Joined: Sat Nov 23, 2019 11:11 pm

Re: Setting GTK colors for Claws Mail

#7 Post by linuxbobtas »

@Melber, many thanks, but yes, that solution does affect other apps.

Yesterday I tested some GTK themes to see what happened, and found that some themes changed the text color for selected messages in Claws Mail (winners), and some didn't (losers). Strange! I've now changed my GTK theme to a winner (one of the very nice vimix series - https://github.com/vinceliuice/vimix-gtk-themes).

I won't mark this thread SOLVED because the core problem is still there, and in future someone might find a solution or a future Claws Mail code change may fix the issue.

User avatar
Melber
Developer
Posts: 1308
Joined: Tue Mar 23, 2021 4:19 pm

Re: Setting GTK colors for Claws Mail

#8 Post by Melber »

linuxbobtas wrote: Thu May 02, 2024 4:50 pm @Melber, many thanks, but yes, that solution does affect other apps.
Out of interest, which ones?

linuxbobtas
Posts: 19
Joined: Sat Nov 23, 2019 11:11 pm

Re: Setting GTK colors for Claws Mail

#9 Post by linuxbobtas »

Apologies, that does work! Many thanks. When I wrote "other apps" I was seeing what the vimix GTK theme was doing, not your suggested CSS. I'm back to my preferred theme and all is well with the CSS tweaks to Thunar and Claws Mail.

Locked

Return to “Software / Configuration”