Firefox With A Dark Theme on KDE5
I’ve had this odd problem with Firefox for a couple of months now. I’ve been able to find partial solutions, but not until today have I discovered the actual fix for it. Firefox’s input elements weren’t following my theme or the GTK them from the OS. I could deal with it, but it was ugly and pretty annoying.
I use a dark theme for KDE because that’s what works best for me visually. KDE even let me set the GTK theme, which I did. I’ve been using it for quite a while now, and it’s worked.
Firefox has a feature that is a godsend to me that allows me to override the colors a page sets to always use a dark background with light nest. That’s what works for me, and I’ve been using the feature for as long as I can remember. It may have even been since Firefox was in beta or even still called Phoenix that I’ve been using that setting.
My problem was that Firefox was that some input widgets on some page would be a white background with black text. It seemed as if it affected non-themed input widgets, maybe. Some buttons were the opposite of my colors, but really the most annoying ones were those drop down lists. The text in those tend to be small, and the opposite them just really washed them out and made them difficult to see. There didn’t really seem to be a pattern to getting them to have the same color scheme as my pages consistently. I had also noticed that the error pages were suddenly black text on a white background. In the past, they followed my GTK theme. The other thing that led me to believe that it was GTK related was the fact that when I set my colors to use the system colors when overriding the ones selected by the page, it was a light theme.
This has been happening for a few months now. I’d found through searching some solutions that partly fixed it, but there was always something that wasn’t right with them. I had figured out that Firefox was not picking up my GTK theme, but didn’t know why. I still don’t know why, but all is well if I start Firefox like this:
env GTK_THEME=Breeze:Dark firefox
I stumbled on that today after search engines frustratingly kept autocorrecting my specific search terms into what they thought I wanted. How I wish I could find a search engine that at least has the option to not think for me. They tend to give the answers to things completely irrelevant to what you’ve actually searched for.
This wasn’t a problem until a few months ago. I don’t know what had changed, but something between KDE and Firefox had changed that it’s not communicating the GTK theme properly. I am thinking it’s something with Firefox because other programs that use GTK didn’t seem to be having this problem. If I tried to override it manually in the
about:config it still wasn’t resolved.
I’m sure there’s a less hackish way to deal with this but what I eventually came up with is going into the KDE Menu editor and changing the Firefox command from
firefox %U to
env GTK_THEME=Breeze:Dark firefox %U.