Start application in the right theme
Summary: Changelog: Improved dark mode support! This diff makes sure that the dark mode preference is written to the Flipper config, and applied during startup, so that the ugly light/dark flash when starting Flipper in dark mode disappears Reviewed By: passy Differential Revision: D29436059 fbshipit-source-id: 0f762149848298512026fbd216d9a9e0bf4276db
This commit is contained in:
committed by
Facebook GitHub Bot
parent
617f8a928c
commit
014e571f74
@@ -108,6 +108,9 @@ if (argv['disable-gpu'] || process.env.FLIPPER_DISABLE_GPU === '1') {
|
||||
}
|
||||
|
||||
process.env.CONFIG = JSON.stringify(config);
|
||||
if (config.darkMode) {
|
||||
nativeTheme.themeSource = 'dark';
|
||||
}
|
||||
|
||||
// possible reference to main app window
|
||||
let win: BrowserWindow;
|
||||
@@ -270,7 +273,6 @@ ipcMain.on('getLaunchTime', (event) => {
|
||||
});
|
||||
|
||||
ipcMain.on('setTheme', (_e, mode: 'light' | 'dark') => {
|
||||
console.log('Switching to theme ' + mode);
|
||||
nativeTheme.themeSource = mode;
|
||||
});
|
||||
|
||||
@@ -362,6 +364,7 @@ function createWindow() {
|
||||
configPath,
|
||||
JSON.stringify({
|
||||
...config,
|
||||
darkMode: nativeTheme.themeSource === 'dark',
|
||||
lastWindowPosition: {
|
||||
x,
|
||||
y,
|
||||
|
||||
Reference in New Issue
Block a user