Askaga
Askaga

Reputation: 6331

How do i make my gtk app use the dark theme?

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?

Upvotes: 16

Views: 7652

Answers (1)

ptomato
ptomato

Reputation: 57920

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.

Upvotes: 19

Related Questions