Skip to content

Commit

Permalink
Fix flash of white background in electron dark mode (#3794)
Browse files Browse the repository at this point in the history
  • Loading branch information
franknoirot authored Sep 5, 2024
1 parent 906ca65 commit e15c38f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ body.dark {
@apply text-chalkboard-10;
}

@media (prefers-color-scheme: dark) {
body,
.body-bg,
.dark .body-bg {
@apply bg-chalkboard-100;
}

body {
scrollbar-color: var(--color-chalkboard-70) var(--color-chalkboard-90);
@apply text-chalkboard-10;
}
}

select {
@apply bg-chalkboard-20;
}
Expand Down
10 changes: 9 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
// template that ElectronJS provides.

import dotenv from 'dotenv'
import { app, BrowserWindow, ipcMain, dialog, shell } from 'electron'
import {
app,
BrowserWindow,
ipcMain,
dialog,
shell,
nativeTheme,
} from 'electron'
import path from 'path'
import { Issuer } from 'openid-client'
import { Bonjour, Service } from 'bonjour-service'
Expand Down Expand Up @@ -75,6 +82,7 @@ const createWindow = (filePath?: string): BrowserWindow => {
icon: path.resolve(process.cwd(), 'assets', 'icon.png'),
frame: os.platform() !== 'darwin',
titleBarStyle: 'hiddenInset',
backgroundColor: nativeTheme.shouldUseDarkColors ? '#1C1C1C' : '#FCFCFC',
})

// and load the index.html of the app.
Expand Down

0 comments on commit e15c38f

Please sign in to comment.