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?
gnome桌面上的某些应用程序(如图像查看器)使用主题的暗色变体。制作我自己的gtk程序需要什么代码才能使用这个主题的黑暗变体?
1 个解决方案
#1
13
Use the gtk-application-prefer-dark-theme
setting. This ought to do it:
使用gtk-application-prefer-dark-theme设置。这应该这样做:
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.
在创建任何小部件之前,您可能需要确保执行此操作。
#1
13
Use the gtk-application-prefer-dark-theme
setting. This ought to do it:
使用gtk-application-prefer-dark-theme设置。这应该这样做:
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.
在创建任何小部件之前,您可能需要确保执行此操作。