From 44fa099a77c7acb226e9d65f8da2ce48ea6c6308 Mon Sep 17 00:00:00 2001
From: Laurent Cozic <laurent@cozic.net>
Date: Mon, 29 Jul 2019 12:05:58 +0200
Subject: [PATCH] Desktop: No longer crash if certain theme properties are not
 set

---
 ElectronClient/app/gui/SideBar.jsx |  2 +-
 ElectronClient/app/theme.js        | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/ElectronClient/app/gui/SideBar.jsx b/ElectronClient/app/gui/SideBar.jsx
index 767ce176ad..02a8833587 100644
--- a/ElectronClient/app/gui/SideBar.jsx
+++ b/ElectronClient/app/gui/SideBar.jsx
@@ -119,7 +119,7 @@ class SideBarComponent extends React.Component {
 				display: "flex",
 				alignItems: "stretch",
 				// Allow 3 levels of color depth
-				backgroundColor: !theme.depthColor ? '#00000000' : theme.depthColor.replace('OPACITY', Math.min(depth * 0.1, 0.3)),
+				backgroundColor: theme.depthColor.replace('OPACITY', Math.min(depth * 0.1, 0.3)),
 			},
 			listItem: {
 				fontFamily: theme.fontFamily,
diff --git a/ElectronClient/app/theme.js b/ElectronClient/app/theme.js
index acd5c21124..465f2858cb 100644
--- a/ElectronClient/app/theme.js
+++ b/ElectronClient/app/theme.js
@@ -345,17 +345,17 @@ function themeStyle(theme) {
 	let output = {};
 	output.zoomRatio = zoomRatio;
 	output.editorFontSize = editorFontSize;
-	if (theme == Setting.THEME_LIGHT) {
-		output = Object.assign({}, globalStyle, fontSizes, lightStyle);
-	}
-	else if (theme == Setting.THEME_DARK) {
-		output = Object.assign({}, globalStyle, fontSizes, darkStyle);
-	}
-	else if (theme == Setting.THEME_SOLARIZED_LIGHT) {
-		output = Object.assign({}, globalStyle, fontSizes, solarizedLightStyle);
-	}
-	else if (theme == Setting.THEME_SOLARIZED_DARK) {
-		output = Object.assign({}, globalStyle, fontSizes, solarizedDarkStyle);
+
+	// All theme are based on the light style, and just override the
+	// relevant properties
+	output = Object.assign({}, globalStyle, fontSizes, lightStyle);
+
+	if (theme == Setting.THEME_DARK) {
+		output = Object.assign({}, output, darkStyle);
+	} else if (theme == Setting.THEME_SOLARIZED_LIGHT) {
+		output = Object.assign({}, output, solarizedLightStyle);
+	} else if (theme == Setting.THEME_SOLARIZED_DARK) {
+		output = Object.assign({}, output, solarizedDarkStyle);
 	}
 
 	// Note: All the theme specific things should go in addExtraStyles