diff --git a/src/page/settings/appearance.tsx b/src/page/settings/appearance.tsx
index 622cb9e..5769ae5 100644
--- a/src/page/settings/appearance.tsx
+++ b/src/page/settings/appearance.tsx
@@ -1,14 +1,11 @@
+import { useState, useEffect, useCallback } from "react";
import { useUserConfig, useUpdateAppearance } from "./hooks";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch";
import { Label } from "@/components/ui/label";
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
-
-const themes = [
- { value: "light", label: "Light" },
- { value: "dark", label: "Dark" },
- { value: "system", label: "System" },
-];
+import { themePresets, applyTheme, getThemeById, getSavedThemeId, saveThemeId } from "@/lib/theme";
+import { Check } from "lucide-react";
const codeThemes = [
{ value: "github-light", label: "GitHub Light" },
@@ -26,11 +23,62 @@ const densities = [
{ value: "comfortable", label: "Comfortable" },
];
+function ThemeSwatch({ preset }: { preset: (typeof themePresets)[0] }) {
+ const c = preset.colors;
+ return (
+
+ );
+}
+
export default function SettingsAppearancePage() {
const { data: config, isLoading } = useUserConfig();
const update = useUpdateAppearance();
const appearance = config?.appearance;
+ const [activeTheme, setActiveTheme] = useState(getSavedThemeId());
+
+ useEffect(() => {
+ setActiveTheme(getSavedThemeId());
+ }, []);
+
+ const handleThemeChange = useCallback((id: string) => {
+ setActiveTheme(id);
+ const preset = getThemeById(id);
+ if (preset) {
+ applyTheme(preset);
+ saveThemeId(id);
+ }
+ }, []);
+
return (
Appearance
@@ -44,28 +92,57 @@ export default function SettingsAppearancePage() {
) : (
+ {/* Color Theme */}
- Theme
- Select your preferred color theme
+ Color Theme
+ Choose a preset color palette for the entire interface
-
+
+ {themePresets.map((preset) => {
+ const isActive = activeTheme === preset.id;
+ return (
+
+ );
+ })}
+
+ {/* Code Theme */}
Code Theme
@@ -88,6 +165,7 @@ export default function SettingsAppearancePage() {
+ {/* Layout Density */}
Layout Density
@@ -110,6 +188,7 @@ export default function SettingsAppearancePage() {
+ {/* Editor */}
Editor
@@ -138,4 +217,4 @@ export default function SettingsAppearancePage() {
)}
);
-}
\ No newline at end of file
+}