On Thursday, 16 June 2016 at 13:12:12 UTC, Gerald wrote:
It can be done fine with on the fly changes, i.e. random
colors, it's somewhat more work then just calling a simple
function call but CSS gives you a lot more power as well. I do
this in Terminix where for certain themes I want to set the
scrollbar background to be the same color as the terminal
background.
Essentially, add a class to the widget and then construct the
CSS for the class with your random background color as a
string. Create a CSSProvider and use loadFromData, same as
captaindet's example, to load the CSS in the string. Finally,
use the widget's style context to add the CSS provider which
you just constructed. If you want to change the color, remove
that provider and add a new one.
Ahhh. Thas possible for sure, thanks alot!
I finally found the solution for my background-color problem: we
have to remove the image first, so this works for me now:
#CssName{
background-image: none;
background-color:green;
color:green;
}