Files
flipper/desktop/static/index.html
Michel Weststrate 014e571f74 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
2021-06-29 08:39:34 -07:00

35 lines
1.1 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
<link id="flipper-theme-import" rel="stylesheet">
<link rel="stylesheet" href="graphiql/graphiql.css">
<link rel="stylesheet" href="vis/vis.min.css">
<title>Flipper</title>
</head>
<body>
<div id="root"></div>
<script>
global.electronRequire = window.require;
</script>
<script>
// load correct theme
try {
if (JSON.parse(window.process.env.CONFIG).darkMode) {
document.getElementById('flipper-theme-import').href="themes/dark.css";
} else {
document.getElementById('flipper-theme-import').href="themes/light.css";
}
} catch(e) {
console.error("Failed to initialize theme", e);
document.getElementById('flipper-theme-import').href="themes/light.css";
}
window.addEventListener('flipper-store-ready', () => global.flipperInit());
</script>
<script src="bundle.js"></script>
</body>
</html>