From 9ba62348bee8ffeacb7593f93aa366c43ae0fbf2 Mon Sep 17 00:00:00 2001 From: Quang Lam Date: Mon, 15 Jun 2020 23:36:39 +0700 Subject: [PATCH] Fix app bar color is inconsistent on Windows & Linux (#197) --- src/components/pages/history/index.js | 6 ++++-- src/components/pages/phrasebook/index.js | 6 ++++-- src/components/pages/preferences/index.js | 7 ++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/pages/history/index.js b/src/components/pages/history/index.js index 1d027483..f6f46421 100644 --- a/src/components/pages/history/index.js +++ b/src/components/pages/history/index.js @@ -61,8 +61,10 @@ const styles = (theme) => ({ marginTop: 12, }, appBarColorDefault: { - background: theme.palette.type === 'dark' ? theme.palette.grey[900] : theme.palette.primary.main, - color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : theme.palette.primary.contrastText, + // eslint-disable-next-line no-nested-ternary + background: theme.palette.type === 'dark' ? theme.palette.grey[900] : (window.process.platform === 'darwin' ? theme.palette.primary.main : null), + // eslint-disable-next-line no-nested-ternary + color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : (window.process.platform === 'darwin' ? theme.palette.primary.contrastText : null), }, title: { flex: 1, diff --git a/src/components/pages/phrasebook/index.js b/src/components/pages/phrasebook/index.js index edeb2a14..7fffd4dc 100644 --- a/src/components/pages/phrasebook/index.js +++ b/src/components/pages/phrasebook/index.js @@ -59,8 +59,10 @@ const styles = (theme) => ({ marginTop: 12, }, appBarColorDefault: { - background: theme.palette.type === 'dark' ? theme.palette.grey[900] : theme.palette.primary.main, - color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : theme.palette.primary.contrastText, + // eslint-disable-next-line no-nested-ternary + background: theme.palette.type === 'dark' ? theme.palette.grey[900] : (window.process.platform === 'darwin' ? theme.palette.primary.main : null), + // eslint-disable-next-line no-nested-ternary + color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : (window.process.platform === 'darwin' ? theme.palette.primary.contrastText : null), }, title: { flex: 1, diff --git a/src/components/pages/preferences/index.js b/src/components/pages/preferences/index.js index d03b3ef0..f4fa2204 100644 --- a/src/components/pages/preferences/index.js +++ b/src/components/pages/preferences/index.js @@ -77,9 +77,10 @@ const styles = (theme) => ({ color: theme.palette.text.secondary, }, appBarColorDefault: { - background: theme.palette.type === 'dark' ? theme.palette.grey[900] : theme.palette.primary.main, - color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : theme.palette.primary.contrastText, - + // eslint-disable-next-line no-nested-ternary + background: theme.palette.type === 'dark' ? theme.palette.grey[900] : (window.process.platform === 'darwin' ? theme.palette.primary.main : null), + // eslint-disable-next-line no-nested-ternary + color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : (window.process.platform === 'darwin' ? theme.palette.primary.contrastText : null), }, title: { flex: 1,