Override all-white background-colour of blank page?
-
I started wondering about this one, I usually use the SD as new tab page. But it's bound to come up sooner or later, some user wants to use a blank page as new tab, and complains it's all white.
I've been searching through the code but I suspect this is using the Chromium-internal about:blank and is not part of the Vivaldi UI code so can't be changed.
Any ideas?
-
Something like this should work:
chrome.tabs.onUpdated.addListener((id, ci, ti) => { if (ti.url && ti.url === 'about:blank') { let bg = document.body.style.getPropertyValue('--colorBg'); if (bg === '') bg = 'black'; let wv = document.querySelector(`webview[id="${id}"]`); if (wv) wv.insertCSS({'code': `body { background-color: ${bg} !important; margin: 0; }`}); } });
Edit: …though it adds some errors to the console…
-
@potmeklecbohdan Thanks a lot for that, you're a champ! I was hoping it would be possible to avoid using a JS mod, but at least there's something
If I could only figure out where the code for the about:blank is stored, but I suspect it's hard-coded into Chromium somewhere.
I guess it's another place where the value of colorBg should be used by by the devs instead of the defaults.
-
@Pathduck So… why haven't you upvoted this request then?
-
@potmeklecbohdan I have now - can't know about every bloody request can I
-
-
Has anyone ever found a way to simply load some custom CSS, like Firefox?
In Firefox it's just the below in
userContent.css
:@-moz-document url("about:home"), url("about:blank"), url("about:newtab"), url("about:privatebrowsing") { html:not(#ublock0-epicker), html:not(#ublock0-epicker) body, #newtab-customize-overlay { background: #23272a !important; color: #ffffff !important; } a { color: #7289da !important; } }
-
@Gwen-Dragon The point is to give the blank page the background color of the theme, not a fixed color. This can’t be done with Stylus and I imagine this can’t be done in Firefox at all. Although it should be mentioned loading code for a supposedly blank page is somewhat ironic.
-
-
@potmeklecbohdan I know, but we aren’t Firefox gladly and can do it properly. If there were no js modifications, I would just make a custom blank page and load it from filesystem instead of using an extension.
-
@Gwen-Dragon Stylus cannot theme about:blank on any browser.
-
should i post here, or there: blank page Custom CSS ?? this one is older, has more participation already. So, i guess here would be right place, right??
-
i was also wondering if about:blank page can be modified. I tried via inspect elements, and was able to do it (ignore the errors ) :
So, was wondering about where is this page located in the installation. I tried web searching, but didnt find anything related - not even in the chrome/chromium context.
-