aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-05-15 14:56:32 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-05-16 00:55:04 +0200
commitd1ce184c7226f452d414ac59ecb3b3288bd70795 (patch)
treea8306e096f4a45a1deba16e8284a677aa02664d9
parentrefactor(renderer): window title setting (diff)
downloadsophie-d1ce184c7226f452d414ac59ecb3b3288bd70795.tar.gz
sophie-d1ce184c7226f452d414ac59ecb3b3288bd70795.tar.zst
sophie-d1ce184c7226f452d414ac59ecb3b3288bd70795.zip
fix(renderer): reduce white flash on start
We inject a CSS file that applies the theme background color even before the javascript for the renderer is loaded. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
-rw-r--r--packages/renderer/src/index.tsx1
-rw-r--r--packages/renderer/src/style.css29
2 files changed, 30 insertions, 0 deletions
diff --git a/packages/renderer/src/index.tsx b/packages/renderer/src/index.tsx
index 09b9b74..964494a 100644
--- a/packages/renderer/src/index.tsx
+++ b/packages/renderer/src/index.tsx
@@ -28,6 +28,7 @@ import { addDisposer } from 'mobx-state-tree';
28import React, { Suspense, lazy } from 'react'; 28import React, { Suspense, lazy } from 'react';
29import { createRoot } from 'react-dom/client'; 29import { createRoot } from 'react-dom/client';
30 30
31import './style.css';
31import Loading from './components/Loading'; 32import Loading from './components/Loading';
32import ThemeProvider from './components/ThemeProvider'; 33import ThemeProvider from './components/ThemeProvider';
33import { exposeToReduxDevtools, hotReload } from './devTools'; 34import { exposeToReduxDevtools, hotReload } from './devTools';
diff --git a/packages/renderer/src/style.css b/packages/renderer/src/style.css
new file mode 100644
index 0000000..d0bf2fb
--- /dev/null
+++ b/packages/renderer/src/style.css
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2022 Kristóf Marussy <kristof@marussy.com>
3 *
4 * This file is part of Sophie.
5 *
6 * Sophie is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 *
18 * SPDX-License-Identifier: AGPL-3.0-only
19 */
20
21body {
22 background-color: #fff;
23}
24
25@media (prefers-color-scheme: dark) {
26 body {
27 background-color: #121212;
28 }
29}