diff --git a/src/pages/App.tsx b/src/pages/App.tsx
index 55a2c27..e6786a0 100644
--- a/src/pages/App.tsx
+++ b/src/pages/App.tsx
@@ -7,6 +7,7 @@ import {
Box,
createTheme,
Drawer,
+ FormControlLabel,
Icon,
IconButton,
List,
@@ -14,10 +15,12 @@ import {
ListItemButton,
ListItemIcon,
ListItemText,
+ Switch,
ThemeProvider,
Toolbar,
Tooltip,
Typography,
+ useColorScheme,
} from "@mui/material";
import * as Icons from "@mui/icons-material";
import { useState } from "react";
@@ -40,7 +43,7 @@ const sidebarItems: Item[] = [
const drawerWidth = 240;
-const darkTheme = createTheme({
+const theme = createTheme({
colorSchemes: {
dark: true,
},
@@ -48,9 +51,14 @@ const darkTheme = createTheme({
function App({ error }: { error?: boolean }) {
const [isOpen, setOpen] = useState(false);
+ const { mode, setMode } = useColorScheme();
+
+ if (!mode) {
+ return null;
+ }
return (
-
+ <>
theme.zIndex.drawer + 1 }}
@@ -67,6 +75,23 @@ function App({ error }: { error?: boolean }) {
DLinux
+ }
+ label="Automatic theme"
+ labelPlacement="start"
+ onChange={() => setMode(mode === "system" ? "light" : "system")}
+ />
+ {mode != "system" && (
+ setMode(mode === "dark" ? "light" : "dark")}
+ >
+ {mode === "dark" ? (
+
+ ) : (
+
+ )}
+
+ )}
}
{localStorage.getItem("key") ? : }
-
+ >
);
}
-export default App;
+export default function ToggleColorMode() {
+ return (
+
+
+
+ );
+}