After changing the theme on my Cinnamon Desktop to a dark theme (Adwaita-dark) a program that I wrote a while ago now displays the buttons incorrect. While e.g. in other programs like the file manager the color of the icons is now white they stay dark here.
I created those buttons using Gtk.Button.new_from_icon_name()
:
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
...
button = Gtk.Button.new_from_icon_name("document-new", 1)
Is there a way of making them automatically adapt their color to the currently active theme?
I had the same issue and I ended up using a *-symbolic
version of the icon.
According to Gnome docs
In the GNOME 3 designs we have identified a number of places where using a symbolic variant of a standard icon is desirable. Symbolic icons are usually low color or monochrome and intended to match the foreground font color. They may be used where a high color, detailed representation isn't warranted.
It means you would rather be using
button = Gtk.Button.new_from_icon_name("document-new-symbolic", 1)