Skip to content

Commit df467fb

Browse files
Merge pull request #932 from naweidner/darkmode
Added Darkmode
2 parents d0b81ea + 097aaad commit df467fb

23 files changed

+858
-333
lines changed

package-lock.json

+573-176
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@sentry/browser": "^6.6.0",
1616
"@testing-library/jest-dom": "^5.16.4",
1717
"@testing-library/react": "^9.5.0",
18-
"@theme-ui/color": "^0.3.5",
19-
"@theme-ui/components": "^0.3.5",
18+
"@theme-ui/color": "^0.14.5",
19+
"@theme-ui/components": "^0.14.5",
2020
"@tippyjs/react": "^4.2.6",
2121
"deepmerge": "^4.2.2",
2222
"eslint": "^7.32.0",
@@ -38,7 +38,7 @@
3838
"react-page-visibility": "^7.0.0",
3939
"react-router-dom": "^5.3.3",
4040
"react-scripts": "^4.0.3",
41-
"theme-ui": "^0.3.5",
41+
"theme-ui": "^0.14.5",
4242
"use-resize-observer": "^7.0.0"
4343
},
4444
"repository": {

src/App.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Beforeunload } from 'react-beforeunload';
99
import { Global } from '@emotion/core';
1010
import { useSettings } from './settings';
1111

12-
1312
import { Provider, useStudioState, STATE_UPLOADED, STATE_UPLOADING } from './studio-state';
1413

1514
import About from './ui/about';
@@ -18,9 +17,9 @@ import Studio from './ui/studio/page';
1817
import SettingsPage from './ui/settings/page';
1918
import Warnings from './ui/warnings';
2019

21-
2220
function App({ settingsManager, userHasWebcam }) {
2321
const settings = useSettings();
22+
2423
return (
2524
<Router basename={process.env.PUBLIC_URL || '/'}>
2625
<Global styles={settings.theme?.customCSS || ''}/>

src/Tooltip.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ const Tooltip = ({ content, ...props }) => (
1111
<Tippy
1212
content = { <span> {content} </span> }
1313
interactive={true}
14-
theme='studio'
1514

1615
sx={{
1716
fontSize: '16px',
18-
backgroundColor: '#43a472',
19-
color: 'white',
17+
backgroundColor: theme => theme.colors.tooltip,
18+
color: theme => theme.colors.tooltip_text,
2019
lineHeight: 'normal',
2120
fontFamily: 'Open Sans',
2221
}}

src/i18n/locales/de.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@
139139
"warning-missing-connection-settings": "Die Verbindung zum Opencast Server wurde noch nicht vollständig hergestellt. Bitte konfigurieren Sie die Verbindung in <1>den Einstellungen</1> (die Aufnahme geht nicht verloren).",
140140

141141
"settings-back-to-recording": "Zurück zur Aufnahme",
142-
143142
"video-settings-open": "Videoeinstellungen öffnen",
144-
"video-settings-close": "Videoeinstellungen schließen"
143+
"video-settings-close": "Videoeinstellungen schließen",
144+
145+
"settings-theme-appearance": "Aussehen",
146+
"settings-theme-dark": "Dunkles Design",
147+
"settings-theme-light": "Helles Design",
148+
"settings-theme-system": "System Design"
145149
}

src/i18n/locales/en.json

+4
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@
140140
"warning-missing-connection-settings": "Connection to Opencast is not fully established: uploading is disabled. Please configure the connection in <1>the settings</1> (you won't lose your recording).",
141141

142142
"settings-back-to-recording": "Back to recording",
143+
"settings-theme-appearance": "Appearance",
144+
"settings-theme-dark": "Dark mode",
145+
"settings-theme-light": "Light mode",
146+
"settings-theme-system": "System design",
143147

144148
"video-settings-open": "Open video settings",
145149
"video-settings-close": "Close video settings"

src/style/global-style.js

-20
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,6 @@ button {
3434
50% { opacity: 0.6 }
3535
to { opacity: 0.85 }
3636
}
37-
38-
/* Remove outline for non-keyboard :focus */
39-
*:focus:not(:focus-visible) {
40-
outline: none !important;
41-
box-shadow: 0 0 0 rgb(255, 255, 255) !important;
42-
}
43-
44-
*:focus-visible {
45-
outline: 5px solid #2e724f !important;
46-
outline-offset: -5px;
47-
}
48-
49-
button:focus-visible {
50-
outline: 5px solid #2e724f !important;
51-
outline-offset: -3px;
52-
}
53-
54-
.tippy-box[data-theme~='studio'] > .tippy-arrow::before {
55-
color: #43a472;
56-
}
5737
`;
5838

5939
export default GlobalStyle;

src/theme.js

+45-6
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,40 @@ const base = {
4444
heights: {
4545
headerHeight: '3em'
4646
},
47+
config: {
48+
useColorSchemeMediaQuery: true,
49+
useLocalStorage: true,
50+
initialColorModeName: 'light',
51+
},
4752
colors: {
4853
text: '#000',
4954
background: '#fff',
5055
button_fg: '#fff',
56+
button_bg: '#363636',
5157
primary: '#47af7a',
52-
secondary: '#30c',
53-
muted: '#888888',
54-
highlight: '#3498db',
5558
error: '#f14668',
5659
gray: ['#363636', '#666666', '#aaaaaa', '#dddddd', '#f5f5f5'],
57-
videoOverlay: 'rgba(255, 255, 255, 0.2)'
60+
element_bg: '#fff',
61+
notification_text: '#fff',
62+
tooltip: '#363636',
63+
tooltip_text: '#fff',
64+
focus: ['#363636', '#dddddd', '#dddddd', '#aaaaaa'],
65+
modes: {
66+
dark: {
67+
text: 'rgba(255, 255, 255, 0.87)',
68+
background: '#1C1C1E',
69+
button_fg: '#fff',
70+
button_bg: '#666666',
71+
primary: '#388c61',
72+
error: 'rgba(241, 70, 104, 0.8)',
73+
gray: ['#f5f5f5', '#dddddd', '#aaaaaa', '#666666', '#363636'],
74+
element_bg: '#363636',
75+
notification_text: 'rgba(255, 255, 255, 0.9)',
76+
tooltip: '#dddddd',
77+
tooltip_text: '#000',
78+
focus: ['#dddddd', '#363636', '#dddddd', '#dddddd'],
79+
}
80+
}
5881
},
5982
text: {
6083
text: {
@@ -113,6 +136,18 @@ const base = {
113136
'--theme-ui-colors-btn-hover': darken('primary', 0.03),
114137
'--theme-ui-colors-controls': '#000',
115138
'--theme-ui-colors-info': '#f5f5f5',
139+
'*:focus:not(:focus-visible)': {
140+
/* Remove outline for non-keyboard :focus */
141+
outline: 'none !important',
142+
boxShadow: '0 0 0 rgb(255, 255, 255) !important',
143+
},
144+
'*:focus-visible': {
145+
outline: theme => `5px solid ${theme.colors.focus[0]}`,
146+
outlineOffset: '-5px',
147+
},
148+
'.tippy-box > .tippy-arrow::before': {
149+
color: theme => `${theme.colors.tooltip}`
150+
},
116151
},
117152
h1: {
118153
...heading,
@@ -177,6 +212,8 @@ const base = {
177212
maxWidth: '100%'
178213
},
179214
input: {
215+
backgroundColor: 'element_bg',
216+
color: 'text',
180217
borderWidth: 1,
181218
borderStyle: 'solid',
182219
borderColor: 'gray.2',
@@ -190,22 +227,24 @@ const base = {
190227
width: '100%',
191228
'&:focus': {
192229
borderColor: 'primary',
193-
boxShadow: theme => `0 0 3px 0 ${theme.colors.primary}`
230+
boxShadow: theme => `0 0 3px 0 ${theme.colors.focus[0]}`
194231
},
195232
'&[aria-invalid="true"]': {
196233
borderColor: 'error',
197234
boxShadow: theme => `0 0 3px 0 ${theme.colors.error}`
198235
}
199236
},
200237
select: {
238+
backgroundColor: 'element_bg',
239+
color: 'text',
201240
height: '2rem',
202241
fontSize: '14pt',
203242
outline: 'none',
204243
transition: 'border-color 0.3s, box-shadow 0.3s',
205244
width: '100%',
206245
'&:focus': {
207246
borderColor: 'primary',
208-
boxShadow: theme => `0 0 3px 0 ${theme.colors.primary}`
247+
boxShadow: theme => `0 0 3px 0 ${theme.colors.focus[0]}}`
209248
}
210249
},
211250
progress: {

0 commit comments

Comments
 (0)