Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce white flickering while in dark mode #2316

Merged
merged 1 commit into from Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions css/webviews.css
Expand Up @@ -3,12 +3,6 @@
position: relative;
}

/* Webpages assume the page background will always be white, but the Electron API to set this is broken on Windows and Linux (https://github.com/electron/electron/issues/20447) - there, the view will always be transparent.
Therefore, the webview background should always be white, except on the new tab page. */
body:not(.is-ntp) #webviews {
background-color: white;
}

.arrow-indicator {
width: 140px;
height: 140px;
Expand Down
5 changes: 4 additions & 1 deletion main/viewManager.js
Expand Up @@ -321,7 +321,10 @@ ipc.on('loadURLInView', function (e, args) {

// wait until the first URL is loaded to set the background color so that new tabs can use a custom background
if (!viewStateMap[args.id].loadedInitialURL) {
viewMap[args.id].setBackgroundColor('#fff')
// Give the site a chance to display something before setting the background, in case it has its own dark theme
viewMap[args.id].webContents.once('dom-ready', function() {
viewMap[args.id].setBackgroundColor('#fff')
})
// If the view has no URL, it won't be attached yet
if (args.id === windows.getState(win).selectedView) {
win.setBrowserView(viewMap[args.id])
Expand Down