From 8ac0a9ba14110333d5325d31871fe4ee4ae3b99a Mon Sep 17 00:00:00 2001 From: Chen-I Lim Date: Mon, 4 Jan 2021 11:19:03 -0800 Subject: [PATCH] Use blue theme by default (rename to defaultTheme) --- webapp/i18n/en.json | 2 +- webapp/i18n/es.json | 1 - webapp/src/components/sidebar.tsx | 12 ++++++------ webapp/src/theme.ts | 22 +++++++++++----------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index 16db2df2d..5b7f410ab 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -47,6 +47,7 @@ "Sidebar.add-board": "+ Add Board", "Sidebar.add-template": "+ New template", "Sidebar.dark-theme": "Dark theme", + "Sidebar.default-theme": "Default theme", "Sidebar.delete-board": "Delete board", "Sidebar.delete-template": "Delete", "Sidebar.duplicate-board": "Duplicate board", @@ -56,7 +57,6 @@ "Sidebar.export-archive": "Export archive", "Sidebar.import-archive": "Import archive", "Sidebar.light-theme": "Light theme", - "Sidebar.mattermost-theme": "Mattermost theme", "Sidebar.no-views-in-board": "No pages inside", "Sidebar.select-a-template": "Select a template", "Sidebar.set-language": "Set language", diff --git a/webapp/i18n/es.json b/webapp/i18n/es.json index 96cd46f5a..06f59de7c 100644 --- a/webapp/i18n/es.json +++ b/webapp/i18n/es.json @@ -35,7 +35,6 @@ "Sidebar.export-archive": "Exportar Archivo", "Sidebar.import-archive": "Importar Archivo", "Sidebar.light-theme": "Apariencia Clara", - "Sidebar.mattermost-theme": "Aparencia Mattermost", "Sidebar.no-views-in-board": "No hay páginas dentro", "Sidebar.set-language": "Establecer idioma", "Sidebar.set-theme": "Establecer apariencia", diff --git a/webapp/src/components/sidebar.tsx b/webapp/src/components/sidebar.tsx index 0f6532328..d981a4bd0 100644 --- a/webapp/src/components/sidebar.tsx +++ b/webapp/src/components/sidebar.tsx @@ -7,7 +7,7 @@ import {Archiver} from '../archiver' import {Board, MutableBoard} from '../blocks/board' import {BoardView, MutableBoardView} from '../blocks/boardView' import mutator from '../mutator' -import {darkTheme, lightTheme, mattermostTheme, setTheme} from '../theme' +import {defaultTheme, darkTheme, lightTheme, setTheme} from '../theme' import {WorkspaceTree} from '../viewModel/workspaceTree' import Button from '../widgets/buttons/button' import IconButton from '../widgets/buttons/iconButton' @@ -302,6 +302,11 @@ class Sidebar extends React.Component { name={intl.formatMessage({id: 'Sidebar.set-theme', defaultMessage: 'Set theme'})} position='top' > + setTheme(defaultTheme)} + /> { name={intl.formatMessage({id: 'Sidebar.light-theme', defaultMessage: 'Light theme'})} onClick={async () => setTheme(lightTheme)} /> - setTheme(mattermostTheme)} - /> diff --git a/webapp/src/theme.ts b/webapp/src/theme.ts index a79b2a8a8..e8573599a 100644 --- a/webapp/src/theme.ts +++ b/webapp/src/theme.ts @@ -10,6 +10,15 @@ export type Theme = { sidebarFg: string } +export const defaultTheme = { + mainBg: '255, 255, 255', + mainFg: '55, 53, 47', + buttonBg: '22, 109, 224', + buttonFg: '255, 255, 255', + sidebarBg: '20, 93, 191', + sidebarFg: '255, 255, 255', +} + export const darkTheme = { mainBg: '55, 53, 47', mainFg: '200, 200, 200', @@ -28,15 +37,6 @@ export const lightTheme = { sidebarFg: '55, 53, 47', } -export const mattermostTheme = { - mainBg: '255, 255, 255', - mainFg: '55, 53, 47', - buttonBg: '22, 109, 224', - buttonFg: '255, 255, 255', - sidebarBg: '20, 93, 191', - sidebarFg: '255, 255, 255', -} - export function setTheme(theme: Theme): void { document.documentElement.style.setProperty('--main-bg', theme.mainBg) document.documentElement.style.setProperty('--main-fg', theme.mainFg) @@ -54,9 +54,9 @@ export function loadTheme(): void { const theme = JSON.parse(themeStr) setTheme(theme) } catch (e) { - setTheme(lightTheme) + setTheme(defaultTheme) } } else { - setTheme(lightTheme) + setTheme(defaultTheme) } }