Implement a dark tray icon for light themes

Hey! Ahh this would be super cool - do you know how KDE normally exposes the theme tint color / light vs dark setting? I know we get a few environment variables through the Snap daemon, so we might be able to do this if it’s one of them.


(Originally posted by bengotow on GitHub.)

Unfortunately I don’t know how KDE does that


(Originally posted by nihil21 on GitHub.)

I second this request. Would be great to have dark icon for light themes.


(Originally posted by soee on GitHub.)

Hey! Ahh this would be super cool - do you know how KDE normally exposes the theme tint color / light vs dark setting? I know we get a few environment variables through the Snap daemon, so we might be able to do this if it’s one of them.

Plasma doesn’t distinguish between light and dark themes, there’s just colour schemes.
You can read ~/.config/kdeglobals to get the colour palette of the active colourscheme.


(Originally posted by pontaoski on GitHub.)

And if your icon is an SVG, you can even embed a stylesheet into it that allows it to conform to the active color scheme: https://cgit.kde.org/breeze-icons.git/tree/icons/status/16/battery-050.svg

For more information, see Guidelines and HOWTOs/Icon Workflow Tips - KDE Community Wiki


(Originally posted by Pointedstick on GitHub.)

This still hasn’t been fixed, I get a white icon on light background using KDE Plasma with Breeze theme. Perhaps a custom fix could be made when it detects “Breeze” (but not “Breeze Dark”) as the theme, as many users will be using it as its the default in Manjaro etc.


(Originally posted by taprobane99 on GitHub.)

Related:

Could you make a dark version of the tray icon for light desktop color schemes and put it on a switch in the preferences? It’s currently invisible with my light color scheme on Xfce.


(Originally posted by justindoran on GitHub.)

(Original post had 4 upvotes.)

Screenshot_20201128_175647

Notice the Mailspring icon, which is barely visible against the white background.

Can you add an option for light-colored panels such as mine? By selecting this option you would be able to toggle the icon color, which would go from white to black.


(Originally posted by DigiOhhh on GitHub.)

On Zorin OS 16. Where’s Mailspring? HA!

zorin-16-mailspring

I have a fork of Mailspring that sports a dark black icon, the problem is that since version 1.10.2 the version I build on my Linux box does not work properly (not even the standard Mailspring), and I don’t have time to fix it. Anyway, if you want to try and build it, you can “git clone” the repository here:

enter the Mailspring directory it and run
npm install
npm run-script build
to produce deb and rpm packages.

@paulatz why not make an identification if you are using the operating system with a dark or light theme to use dark or light icons?

Because I cannot. And what is stopping me is:

  1. How do you detect if the theme is light or dark? Each Linux desktop may or may not support this feature, and they would all use different ways. Also, the theme lightness does not necessarily reflect the actual color of the systray. There is a dark-mode electron package that seems to support MacOSX, but not linux.
  2. What would work, is provide an SVG icon, that can be colorized by the theme engine. Or an icon that can be themed. However, Mailspring uses the “Nativeimage” electron package, which only supports PNG images.
  3. The last option would be to add a setting option, or an extension, to change this icon. But this is way above my skills with electron (I program scientific software in Fortran for a living!)

Great points, thinking about it I believe item 3 is the best fit for the solution.

I understand the technical debt, for that, we have to turn to the maintainers to ask what is the best way to do this implementation

cc @bengotow

Anyway, I’ll go back to it eventually. I have not been able to have electron nativeTheme return anything useful, but it maybe just me making some silly mistake. On the other hand, today I found out that if I provide a mostly monochrome dark icon even in png, KDE seems to be able to invert it on its own when selecting a dark theme. I don’t know if gnome can do the same.

p.s. I have built some binaries for this version, you can test them if you wish:

1 Like

Seems like I did finally get it to work in the last b2 of my patch, but… It is not supported by electron due to upstream bugs until very recently, for sure not the version 14.3 used to build it. I leave the code there for the moment, will come back to it in the future https://github.com/microsoft/vscode/issues/91169

1 Like

@paulatz it is worth opening a PR on mailspring with prefix “WIP:” with your modification and let the maintainers know how it is progressing, so they can help you with the best way to implement it.

cc @bengotow @Phylu

I am totally willing to give some pointers if you give it a try. :slight_smile:

Thank you.
I’ve opened a PR here https://github.com/Foundry376/Mailspring/pull/2395
I think it would especially benefit from someone else testing it, as I don’t have a testing setup for all the Linux desktop environments