Skip to content

Devel GTK CSS selector

Simeon Andreev edited this page Feb 23, 2023 · 1 revision

Avoiding CSS warnings in console

GTK CSS has a specific format in order to be parsed without warnings. The format is as follows:

<widget name/selector>` {`<property>`: `<value>`;}

For example:

GtkWidget {background-color: rgba(255, 0, 0, 255);}

Forming CSS strings with this format will not cause any warnings. Additional semi-colons will cause problems. Note that only one semi-colon is needed.

Please note that the selectors have changed for GTK3.20+, so using things like GtkWidget as a selector will not work. Thankfully, GTK3 CSS is now part of the API, so you can look up the proper selectors here.

Clone this wiki locally