diff --git a/components/dashboard/src/App.tsx b/components/dashboard/src/App.tsx index f4fb79ed3a52c6..441f905ab68b41 100644 --- a/components/dashboard/src/App.tsx +++ b/components/dashboard/src/App.tsx @@ -58,7 +58,7 @@ function App() { useEffect(() => { const updateTheme = () => { - const isDark = localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches); + const isDark = localStorage.theme === 'dark' || (localStorage.theme === 'system' && window.matchMedia("(prefers-color-scheme: dark)").matches); document.documentElement.classList.toggle('dark', isDark); } updateTheme(); diff --git a/components/dashboard/src/settings/Preferences.tsx b/components/dashboard/src/settings/Preferences.tsx index 044fbe8e3c7201..7b1e01bd1292d8 100644 --- a/components/dashboard/src/settings/Preferences.tsx +++ b/components/dashboard/src/settings/Preferences.tsx @@ -13,7 +13,7 @@ import vscode from '../images/vscode.svg'; import { PageWithSubMenu } from "../components/PageWithSubMenu"; import settingsMenu from "./settings-menu"; -type Theme = 'system' | 'dark' | 'light'; +type Theme = 'light' | 'dark' | 'system'; export default function Preferences() { const { user } = useContext(UserContext); @@ -30,20 +30,20 @@ export default function Preferences() { await getGitpodService().server.updateLoggedInUser({ additionalData }); setDefaultIde(value); } - const [ theme, setTheme ] = useState(localStorage.theme || 'system'); + const [ theme, setTheme ] = useState(localStorage.theme || 'light'); const actuallySetTheme = (theme: Theme) => { - if (theme === 'light' || theme === 'dark') { + if (theme === 'dark' || theme === 'system') { localStorage.theme = theme; } else { localStorage.removeItem('theme'); } - const isDark = localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches); + const isDark = localStorage.theme === 'dark' || (localStorage.theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches); document.documentElement.classList.toggle('dark', isDark); setTheme(theme); } return
- +

Default IDE

Choose which IDE you want to use.