How can I get the default colors in GTK?

Context

In GTK 3, people can set their own themes. Even the default theme (Adwaita) has two options: light and dark. Since I am writing my own widget (in python), I need to get these colors in order to avoid draft on black or white white.

Question

How can I access the default colors for a GTK user theme?


Things that don't work

Why don't I want to copy the style from another widget?

Because the pristine color is out there somewhere. I do not see, in principle, why I should be forced to indirectly refer to it.

Also, how would you react if you crashed the program just because you dared to delete one tag somewhere? How would you react by changing the color of one label in fact, changing the color of other, completely unrelated widgets?

I do not want such surprises.

+4
source share
1 answer

do_draw() . , self.get_style_context().get_color(), ...get_border_color(), ...get_background_color().

0

Source: https://habr.com/ru/post/1650792/


All Articles