Dark theme support

How does GTK4 application supports dark theme? Is it opt-in or should work by default?
I’ve ported Gnote to Gtk4 and it does work in dark theme when I set GTK_THEME=Adwaita:dark, but not when I switch dark mode in Settings.
I see that switching to dark mode in Settings changes the color-scheme key in org.gnome.desktop.interface. Is that the one to monitor and do something (like set a property that dark is prefered), or is there something else?
Additional note: libadwaita is out of the question ATM being days till next release.

GTK doesn’t have built-in dark mode switching by itself, so you’ll need to implement it manually for now.

You’ll want to use the settings portal, not gsettings directly. You can read more here:

1 Like

If you don’t have any support for the dark style (not “theme”) then just listening to the preference change won’t do you any good: you will need to load CSS to style your widgets.

The recommendation is to release without dark style support, and then take your time to port to libadwaita.