14

Some apps on the gnome desktop like the image viewer use a dark variation of the theme. What code is required to make my own gtk program use this dark variation of the theme?

Askaga
  • 6,061
  • 5
  • 25
  • 49

1 Answers1

17

Use the gtk-application-prefer-dark-theme setting. This ought to do it:

g_object_set(gtk_settings_get_default(),
    "gtk-application-prefer-dark-theme", TRUE,
    NULL);

You may need to make sure you do it before you create any widgets.

ptomato
  • 56,175
  • 13
  • 112
  • 165