GTK+3: Passing colours from Python to CSS

340 Views Asked by At

In the app I'm building, I have a variable with a hex colour code:

accentColour = "#0877df"

This value can be changed by the user.

Since I'm using GTK+3, I'm using a CSS file to style the widgets. How can I pass the accentColour variable to use as a colour in CSS?

1

There are 1 best solutions below

2
On BEST ANSWER

You can't. Instead, I would put only the default color in your CSS file. Then make a CSS string in your code that overrides only the things that are affected by the color change, and add it in a separate CSS provider.