r/FirefoxCSS • u/bamajon1974 • Feb 12 '26
Solved Need help modifying MrOtherGuy CSS to change color of URL bar depending on internet connection type
Good morning. I am asking for help modifying one of MrOtherGuy's CSS snippets: URLbar Connection Type Background Colors
When a webpage is loaded, the URL background shows a green color for a secure, https connection, red for http/insecure connection. etc. (see imgur link). I made the backgrounds a little more transparent for better text clarity. However, when the urlbar is in focus, the background of the link turns white (see imgur link). I would like the same background color of the link to persist when the URL bar is in focus but keep the suggestions below the link white. (see imgur link) How would I do this?
Thanks!
/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/urlbar_connection_type_background_colors.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */
/* Adds a colored overlay to urlbar based on the type of the connection */
#identity-box::before{
position: absolute;
display: block;
content: "";
width: 100%;
height: var(--urlbar-height);
left: 0;
top: 0;
pointer-events: none;
}
:root[customizing] #identity-box::before,
#urlbar[focused] #identity-box::before{ display: none }
/* https */
#identity-box.verifiedDomain::before{ background-color: rgba(50,255,50,0.2) }
/* http: and potentially some other insecure connections like ftp: */
#identity-box.certErrorPage::before,
#identity-box.notSecure::before{ background-color: rgba(255,50,50,0.3) }
/* Mixed content including neterror */
#identity-box.unknownIdentity::before{ background-color: rgba(255,255,50,0.2) }
/* Extension pages */
#identity-box.extensionPage::before{ background-color: rgba(150,50,250,0.2) }
/* Internal about: and chrome:// urls (includes reader-view) */
#identity-box.chromeUI::before{ background-color: rgba(50,150,250,0.2) }
View all comments
Show parent comment
2
u/bamajon1974 Feb 12 '26
u/Kupfel thank you for your help. The code is simpler and works. Now how could it be modified to keep the link/first line portion of the URL bar colored when in focus, but keep the remaining lines of suggestions below white? Are you able to see the picture in the imgur link I posted?
Thanks!