(core) Add dark mode to user preferences

Summary:
Adds initial implementation of dark mode. Preferences for dark mode are
available on the account settings page. Dark mode is currently a beta feature
as there are still some small bugs to squash and a few remaining UI elements
to style.

Test Plan: Browser tests.

Reviewers: jarek

Reviewed By: jarek

Subscribers: paulfitz, jarek

Differential Revision: https://phab.getgrist.com/D3587
This commit is contained in:
George Gevoian
2022-09-05 18:51:57 -07:00
parent d7b3fb972c
commit ec157dc469
122 changed files with 3616 additions and 1075 deletions

View File

@@ -4,7 +4,7 @@ import {ConnectState} from 'app/client/models/ConnectState';
import {urlState} from 'app/client/models/gristUrlState';
import {Expirable, IAppError, Notification, Notifier, NotifyAction, Progress} from 'app/client/models/NotifyModel';
import {cssHoverCircle, cssTopBarBtn} from 'app/client/ui/TopBarCss';
import {colors, vars} from 'app/client/ui2018/cssVars';
import {theme, vars} from 'app/client/ui2018/cssVars';
import {icon} from 'app/client/ui2018/icons';
import {IconName} from "app/client/ui2018/IconList";
import {menuCssClass} from 'app/client/ui2018/menus';
@@ -193,8 +193,8 @@ function buildConnectStateButton(state: ConnectState): Element {
const cssDropdownWrapper = styled('div', `
background-color: white;
border: 1px solid ${colors.darkGrey};
background-color: ${theme.notificationsPanelBodyBg};
border: 1px solid ${theme.notificationsPanelBorder};
padding: 0px;
`);
@@ -208,17 +208,18 @@ const cssDropdownHeader = styled('div', `
justify-content: space-between;
align-items: center;
padding: 24px;
background-color: ${colors.lightGrey};
outline: 1px solid ${colors.darkGrey};
background-color: ${theme.notificationsPanelHeaderBg};
outline: 1px solid ${theme.notificationsPanelBorder};
`);
const cssDropdownHeaderTitle = styled('span', `
color: ${theme.text};
font-weight: bold;
`);
const cssDropdownFeedbackLink = styled('div', `
display: flex;
color: ${colors.lightGreen};
color: ${theme.controlFg};
cursor: pointer;
user-select: none;
&:hover {
@@ -227,21 +228,21 @@ const cssDropdownFeedbackLink = styled('div', `
`);
const cssDropdownFeedbackIcon = styled(icon, `
background-color: ${colors.lightGreen};
background-color: ${theme.controlFg};
margin-right: 4px;
`);
const cssDropdownStatus = styled('div', `
padding: 16px 48px 24px 48px;
text-align: center;
border-top: 1px solid ${colors.darkGrey};
border-top: 1px solid ${theme.notificationsPanelBorder};
`);
const cssDropdownStatusText = styled('div', `
display: inline-block;
margin: 8px 0 0 0;
text-align: left;
color: ${colors.slate};
color: ${theme.lightText};
`);
// z-index below is set above other assorted children of <body> which include z-index such as 999
@@ -279,7 +280,7 @@ const cssToastActions = styled('div', `
display: flex;
align-items: flex-end;
margin-top: 16px;
color: ${colors.lightGreen};
color: ${theme.toastControlFg};
`);
const cssToastWrapper = styled('div', `
@@ -292,8 +293,8 @@ const cssToastWrapper = styled('div', `
padding: 12px;
border-radius: 3px;
color: ${colors.light};
background-color: ${vars.toastBg};
color: ${theme.toastText};
background-color: ${theme.toastBg};
pointer-events: auto;
@@ -301,28 +302,28 @@ const cssToastWrapper = styled('div', `
transition: opacity ${Expirable.fadeDelay}ms;
&-error {
border-left: 6px solid ${colors.error};
border-left: 6px solid ${theme.toastErrorBg};
padding-left: 6px;
--icon-color: ${colors.error};
--icon-color: ${theme.toastErrorIcon};
}
&-success {
border-left: 6px solid ${colors.darkGreen};
border-left: 6px solid ${theme.toastSuccessBg};
padding-left: 6px;
--icon-color: ${colors.darkGreen};
--icon-color: ${theme.toastSuccessIcon};
}
&-warning {
border-left: 6px solid ${colors.warningBg};
border-left: 6px solid ${theme.toastWarningBg};
padding-left: 6px;
--icon-color: ${colors.warning};
--icon-color: ${theme.toastWarningIcon};
}
&-info {
border-left: 6px solid ${colors.lightBlue};
border-left: 6px solid ${theme.toastInfoBg};
padding-left: 6px;
--icon-color: ${colors.lightBlue};
--icon-color: ${theme.toastInfoIcon};
}
&-info .${cssToastActions.className} {
color: ${colors.lighterBlue};
color: ${theme.toastInfoControlFg};
}
&-left-icon {
@@ -340,9 +341,9 @@ const cssToastWrapper = styled('div', `
}
.${cssDropdownContent.className} > & {
background-color: unset;
color: unset;
color: ${theme.text};
border-radius: 0px;
border-top: 1px solid ${colors.darkGrey};
border-top: 1px solid ${theme.notificationsPanelBorder};
margin: 0px;
padding: 16px 20px;
}
@@ -389,8 +390,8 @@ const cssToastMemos = styled('div', `
const cssToastMemo = styled('div', `
margin: 3px;
color: ${colors.dark};
background: ${colors.light};
color: ${theme.text};
background: ${theme.notificationsPanelBodyBg};
padding: 3px;
`);
@@ -399,16 +400,16 @@ const cssProgressBarWrapper = styled('div', `
margin-bottom: 11px;
height: 3px;
border-radius: 3px;
background-color: ${colors.light};
background-color: ${theme.progressBarBg};
`);
const cssProgressBarSize = styled('span', `
color: ${colors.slate};
color: ${theme.toastLightText};
`);
const cssProgressBarStatus = styled('div', `
height: 3px;
min-width: 3px;
border-radius: 3px;
background-color: ${colors.lightGreen};
background-color: ${theme.progressBarFg};
`);