Skip to content

Change Entry Placeholder Color

Put this inside your :vars CSS selector…

--placeholder_text_color: red;

I’ve been recently trying to change the color of my applications launcher entry’s placeholder, it was so difficult to find resources on how to do so. I couldn’t find any resources sadly so I had to look up into it myself.

I went over to GTK’s sources to find this line which tries to lookup a color from the StyleContext object (using the gtk_style_context_lookup_color method), this gave me the hope that it’s somewhere possible to change the color because it’s not hardcoded into the source code.

So I had to know what this mysterious function does, thankfully documentations exist, but as usual, programmers suck at writing docs, I couldn’t really understand, from where does this function fetch the given color name? That’s why I had to dig deeper.

Thankfully this time I wasn’t empty handed, I found this issue which mentions this function specifically. in the comments there I’ve found this specific comment which mentions the @define-color CSS syntax.

Now I knew it had something to do with GTK’s own color variables syntax. in Fabric we compile those from normal CSS variables (AKA, --var-name), so I launched a editor and modified my config to include this line in the :vars CSS selector…

--placeholder_text_color: red;

And thankfully it did work! It wasn’t all wasted though :)