如何让我的GTK应用程序中使用深色主题? [英] How do i make my gtk app use the dark theme?

查看:203
本文介绍了如何让我的GTK应用程序中使用深色主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GNOME桌面像图像浏览器上的某些应用程序使用主题的明暗变化。
什么code为使自己的GTK程序中使用的主题这个黑暗的变化要求?

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?

推荐答案

使用的<一个href=\"https://developer.gnome.org/gtk3/3.2/GtkSettings.html#GtkSettings--gtk-application-$p$pfer-dark-theme\"><$c$c>gtk-application-$p$pfer-dark-theme设置。这应该做到这一点:

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.

这篇关于如何让我的GTK应用程序中使用深色主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆