I’m new to gtk3 and CSS and I’m not sure I’m approaching this problem in the right way. None of the things I’ve tried have worked, so I hope someone can point me in the right direction.
My program uses a bunch of Gtk.Entry’s to set parameters. Some of the parameters can either take a user supplied value or be set automatically by the program. I used to use a separate checkbox by the side of an Entry, and the automatic value would be used if the box was checked. It would be neater, though, to get rid of the checkbox and simply say that an empty Entry indicates that the automatic value should be used. To make it clear that that’s what’s happening, though, I’d like to write “automatic” in the Entry if the user hasn’t entered a value. I can catch keypress events in the Entry so it displays “automatic” when it’s empty and deletes it when the user starts typing. The problem is that “automatic” should be written in a different color, or in italics, or something, to indicate that it’s not a value entered by the user.
I can get the current foreground and background colors from the StyleContext, but how do I set new colors? Entry.override_color() is deprecated.
Can I use CSS? How would I indicate that special colors or fonts should be applied only to Entrys that are in the “automatic” state?
Should I be using pango to change the font? That seems like overkill and not easy.
Thanks for any suggestions.