(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

@@ -1,6 +1,6 @@
import {ACIndex, ACItem, buildHighlightedDom} from 'app/client/lib/ACIndex';
import {Autocomplete, IAutocompleteOptions} from 'app/client/lib/autocomplete';
import {colors} from "app/client/ui2018/cssVars";
import {theme} from "app/client/ui2018/cssVars";
import {icon} from "app/client/ui2018/icons";
import {menuCssClass} from 'app/client/ui2018/menus';
import {dom, DomElementArg, Holder, IDisposableOwner, Observable, styled} from 'grainjs';
@@ -96,11 +96,12 @@ const cssSelectBtn = styled('div', `
position: relative;
width: 100%;
height: 30px;
color: ${colors.dark};
--icon-color: ${colors.dark};
color: ${theme.selectButtonFg};
--icon-color: ${theme.selectButtonFg};
`);
const cssSelectItem = styled('li', `
color: ${theme.menuItemFg};
display: block;
white-space: pre;
overflow: hidden;
@@ -110,12 +111,14 @@ const cssSelectItem = styled('li', `
cursor: pointer;
&.selected {
background-color: var(--weaseljs-selected-background-color, #5AC09C);
color: var(--weaseljs-selected-color, white);
background-color: ${theme.menuItemSelectedBg};
color: ${theme.menuItemSelectedFg};
}
`);
const cssInput = styled('input', `
color: ${theme.inputFg};
background-color: ${theme.inputBg};
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
@@ -123,20 +126,23 @@ const cssInput = styled('input', `
width: 100%;
padding: 0 6px;
outline: none;
border: 1px solid ${colors.darkGrey};
border: 1px solid ${theme.inputBorder};
border-radius: 3px;
cursor: pointer;
line-height: 16px;
cursor: pointer;
&:disabled {
color: grey;
background-color: initial;
color: ${theme.inputDisabledFg};
background-color: ${theme.inputDisabledBg};
}
&:focus {
cursor: initial;
outline: none;
box-shadow: 0px 0px 2px 2px #5E9ED6;
box-shadow: 0px 0px 2px 2px ${theme.inputFocus};
}
&::placeholder {
color: ${theme.inputPlaceholderFg};
}
`);
@@ -147,8 +153,8 @@ const cssIcon = styled(icon, `
`);
const cssMatchText = styled('span', `
color: ${colors.lightGreen};
color: ${theme.autocompleteMatchText};
.selected > & {
color: ${colors.lighterGreen};
color: ${theme.autocompleteSelectedMatchText};
}
`);

View File

@@ -18,7 +18,7 @@
import { ACItem } from 'app/client/lib/ACIndex';
import { modKeyProp } from 'app/client/lib/browserInfo';
import { Autocomplete, IAutocompleteOptions } from 'app/client/lib/autocomplete';
import { colors, testId } from 'app/client/ui2018/cssVars';
import { colors, testId, theme } from 'app/client/ui2018/cssVars';
import { icon } from 'app/client/ui2018/icons';
import { csvDecodeRow, csvEncodeRow } from 'app/common/csvFormat';
import { computedArray, IDisposableCtor, IObsArraySplice, ObsArray, obsArray, Observable } from 'grainjs';
@@ -679,6 +679,8 @@ const cssInputWrapper = styled('div', `
`);
const cssTokenInput = styled('input', `
color: ${theme.cellEditorFg};
background-color: ${theme.cellEditorBg};
flex: auto;
-webkit-appearance: none;
-moz-appearance: none;

View File

@@ -1,5 +1,5 @@
import { theme } from 'app/client/ui2018/cssVars';
import { Disposable, dom, Observable, styled } from 'grainjs';
import { colors } from 'app/client/ui2018/cssVars';
/**
* Simple validation controls. Renders as a red text with a validation message.
@@ -117,5 +117,5 @@ export class Validator extends Disposable {
}
const cssError = styled('div.validator', `
color: ${colors.error};
color: ${theme.errorText};
`);

View File

@@ -103,7 +103,7 @@ div:hover > .kf_tooltip {
min-width: 16px;
min-height: 16px;
padding: 4px;
background-color: white;
background-color: var(--grist-theme-popup-bg, white);
border-radius: 2px;
box-shadow: 0 1px 1px 1px rgba(0,0,0,0.15);
line-height: 1.1rem;
@@ -129,7 +129,7 @@ div:hover > .kf_tooltip {
right: 20px;
width: 10px;
height: 10px;
background-color: white;
background-color: var(--grist-theme-popup-bg, white);
transform: rotate(45deg);
z-index: 11;
}
@@ -393,6 +393,7 @@ div:hover > .kf_tooltip {
}
.kf_label {
color: var(--grist-theme-text, unset);
white-space: nowrap;
font-size: 1.1rem;
cursor: default;
@@ -436,7 +437,7 @@ div:hover > .kf_tooltip {
top: 0;
left: 0;
padding: 0;
color: #333;
color: var(--grist-theme-input-fg, #333);
}
.elabel_content_measure {