diff --git a/src/components/WindowTitle.tsx b/src/components/WindowTitle.tsx
index bae059d1..113cfea9 100644
--- a/src/components/WindowTitle.tsx
+++ b/src/components/WindowTitle.tsx
@@ -3,6 +3,7 @@ import { WindowInstance } from "@/types/app";
import { WindowToolbar } from "./WindowToolbar";
import { WindowRenderer } from "./WindowRenderer";
import { useDynamicWindowTitle } from "./DynamicWindowTitle";
+import { useGrimoire } from "@/core/state";
interface WindowTileProps {
id: string;
@@ -13,12 +14,20 @@ interface WindowTileProps {
export function WindowTile({ id, window, path, onClose }: WindowTileProps) {
const { title, icon, tooltip } = useDynamicWindowTitle(window);
+ const { setWindowBackgroundColor } = useGrimoire();
const Icon = icon;
// Custom toolbar renderer to include icon
const renderToolbar = () => {
return (
-
+
{Icon && (
@@ -29,7 +38,13 @@ export function WindowTile({ id, window, path, onClose }: WindowTileProps) {
{title}
-
onClose(id)} />
+ onClose(id)}
+ backgroundColor={window.backgroundColor}
+ onBackgroundColorChange={(color) =>
+ setWindowBackgroundColor(id, color)
+ }
+ />
);
};
diff --git a/src/components/WindowToolbar.tsx b/src/components/WindowToolbar.tsx
index 05cbf0ce..396a1ec0 100644
--- a/src/components/WindowToolbar.tsx
+++ b/src/components/WindowToolbar.tsx
@@ -1,12 +1,76 @@
-import { X } from "lucide-react";
+import { X, Palette } from "lucide-react";
+import { useState } from "react";
interface WindowToolbarProps {
onClose?: () => void;
+ backgroundColor?: string;
+ onBackgroundColorChange?: (color: string) => void;
}
-export function WindowToolbar({ onClose }: WindowToolbarProps) {
+const COLORS = [
+ { label: "Default", value: undefined },
+ { label: "Red", value: "#ef4444" },
+ { label: "Orange", value: "#f97316" },
+ { label: "Yellow", value: "#eab308" },
+ { label: "Green", value: "#22c55e" },
+ { label: "Cyan", value: "#06b6d4" },
+ { label: "Blue", value: "#3b82f6" },
+ { label: "Purple", value: "#8b5cf6" },
+ { label: "Pink", value: "#ec4899" },
+ { label: "Indigo", value: "#6366f1" },
+ { label: "Teal", value: "#14b8a6" },
+ { label: "Gray", value: "#6b7280" },
+];
+
+export function WindowToolbar({
+ onClose,
+ backgroundColor,
+ onBackgroundColorChange,
+}: WindowToolbarProps) {
+ const [showColorPicker, setShowColorPicker] = useState(false);
+
return (
- <>
+
+
+
+
+ {showColorPicker && (
+
+
+ {COLORS.map((color) => (
+
+ ))}
+
+
+ )}
+
+
{onClose && (
)}
- >
+
);
}
diff --git a/src/core/logic.ts b/src/core/logic.ts
index 51d08bde..e9541793 100644
--- a/src/core/logic.ts
+++ b/src/core/logic.ts
@@ -263,3 +263,28 @@ export const setActiveAccountRelays = (
},
};
};
+
+/**
+ * Updates the background color of a window.
+ */
+export const setWindowBackgroundColor = (
+ state: GrimoireState,
+ windowId: string,
+ backgroundColor: string,
+): GrimoireState => {
+ const window = state.windows[windowId];
+ if (!window) {
+ return state;
+ }
+
+ return {
+ ...state,
+ windows: {
+ ...state.windows,
+ [windowId]: {
+ ...window,
+ backgroundColor,
+ },
+ },
+ };
+};
diff --git a/src/core/state.ts b/src/core/state.ts
index 55fff118..eca0384e 100644
--- a/src/core/state.ts
+++ b/src/core/state.ts
@@ -104,5 +104,9 @@ export const useGrimoire = () => {
setState((prev) => Logic.setActiveAccount(prev, pubkey)),
setActiveAccountRelays: (relays: any) =>
setState((prev) => Logic.setActiveAccountRelays(prev, relays)),
+ setWindowBackgroundColor: (windowId: string, backgroundColor: string) =>
+ setState((prev) =>
+ Logic.setWindowBackgroundColor(prev, windowId, backgroundColor),
+ ),
};
};
diff --git a/src/types/app.ts b/src/types/app.ts
index 73c13da3..a10291c2 100644
--- a/src/types/app.ts
+++ b/src/types/app.ts
@@ -24,6 +24,7 @@ export interface WindowInstance {
appId: AppId;
title: string;
props: any;
+ backgroundColor?: string;
}
export interface Workspace {