Get font color of the current GTK theme

后端 未结 1 550
轻奢々
轻奢々 2020-12-19 14:47

I need to get the font color of the current theme.

I found this question that explains it how to do it in C with gtk_style_lookup_color, but it seems th

相关标签:
1条回答
  • 2020-12-19 15:21

    I found the answer using gtk.settings.

        settings=Gtk.Settings.get_default()
    
        colors=settings.get_property("gtk-color-scheme")
        colors=colors.split("\n")
    
        for color in colors:
            if 'text' in color:
                text_color=color.split(':')[1].strip()
                print text_color
                break
    

    It seems that the "gtk-color-scheme" property stores all the colors of the theme, so if you are searching for any other color you can find it in the same way!

    0 讨论(0)
提交回复
热议问题