diff --git a/App.tsx b/App.tsx index a78749b30..0bba78be8 100755 --- a/App.tsx +++ b/App.tsx @@ -64,6 +64,8 @@ function App() { updateKeyBinding, resetKeyBinding, resetAllKeyBindings, + customCSS, + setCustomCSS, } = useSettingsState(); const { @@ -542,6 +544,8 @@ function App() { onUpdateKeyBinding={updateKeyBinding} onResetKeyBinding={resetKeyBinding} onResetAllKeyBindings={resetAllKeyBindings} + customCSS={customCSS} + onCustomCSSChange={setCustomCSS} /> {/* Protocol Select Dialog for QuickSwitcher */} diff --git a/application/state/useSettingsState.ts b/application/state/useSettingsState.ts index ea36f108b..d78183121 100644 --- a/application/state/useSettingsState.ts +++ b/application/state/useSettingsState.ts @@ -10,6 +10,7 @@ STORAGE_KEY_TERM_FONT_SIZE, STORAGE_KEY_TERM_SETTINGS, STORAGE_KEY_HOTKEY_SCHEME, STORAGE_KEY_CUSTOM_KEY_BINDINGS, +STORAGE_KEY_CUSTOM_CSS, } from '../../infrastructure/config/storageKeys'; import { TERMINAL_THEMES } from '../../infrastructure/config/terminalThemes'; import { TERMINAL_FONTS, DEFAULT_FONT_SIZE } from '../../infrastructure/config/fonts'; @@ -53,6 +54,9 @@ export const useSettingsState = () => { const [customKeyBindings, setCustomKeyBindings] = useState(() => localStorageAdapter.read(STORAGE_KEY_CUSTOM_KEY_BINDINGS) || {} ); + const [customCSS, setCustomCSS] = useState(() => + localStorageAdapter.readString(STORAGE_KEY_CUSTOM_CSS) || '' + ); useEffect(() => { applyThemeTokens(theme, primaryColor); @@ -84,6 +88,20 @@ export const useSettingsState = () => { localStorageAdapter.write(STORAGE_KEY_CUSTOM_KEY_BINDINGS, customKeyBindings); }, [customKeyBindings]); + // Apply and persist custom CSS + useEffect(() => { + localStorageAdapter.writeString(STORAGE_KEY_CUSTOM_CSS, customCSS); + + // Apply custom CSS to document + let styleEl = document.getElementById('netcatty-custom-css') as HTMLStyleElement | null; + if (!styleEl) { + styleEl = document.createElement('style'); + styleEl.id = 'netcatty-custom-css'; + document.head.appendChild(styleEl); + } + styleEl.textContent = customCSS; + }, [customCSS]); + // Get merged key bindings (defaults + custom overrides) const keyBindings = useMemo((): KeyBinding[] => { return DEFAULT_KEY_BINDINGS.map(binding => { @@ -178,5 +196,7 @@ export const useSettingsState = () => { updateKeyBinding, resetKeyBinding, resetAllKeyBindings, + customCSS, + setCustomCSS, }; }; diff --git a/components/SettingsDialog.tsx b/components/SettingsDialog.tsx index 42e4df466..4a56d056b 100644 --- a/components/SettingsDialog.tsx +++ b/components/SettingsDialog.tsx @@ -62,14 +62,36 @@ interface SettingsDialogProps { onUpdateKeyBinding?: (bindingId: string, scheme: 'mac' | 'pc', newKey: string) => void; onResetKeyBinding?: (bindingId: string, scheme?: 'mac' | 'pc') => void; onResetAllKeyBindings?: () => void; + customCSS?: string; + onCustomCSSChange?: (css: string) => void; } +// More comprehensive color palette const COLORS = [ + // Blues + { name: "Sky Blue", value: "199 89% 48%" }, { name: "Blue", value: "221.2 83.2% 53.3%" }, + { name: "Indigo", value: "234 89% 62%" }, + // Purples { name: "Violet", value: "262.1 83.3% 57.8%" }, + { name: "Purple", value: "271 81% 56%" }, + { name: "Fuchsia", value: "292 84% 61%" }, + // Pinks & Reds + { name: "Pink", value: "330 81% 60%" }, { name: "Rose", value: "346.8 77.2% 49.8%" }, + { name: "Red", value: "0 72% 51%" }, + // Oranges & Yellows { name: "Orange", value: "24.6 95% 53.1%" }, + { name: "Amber", value: "38 92% 50%" }, + { name: "Yellow", value: "48 96% 53%" }, + // Greens + { name: "Lime", value: "84 81% 44%" }, { name: "Green", value: "142.1 76.2% 36.3%" }, + { name: "Emerald", value: "160 84% 39%" }, + { name: "Teal", value: "173 80% 40%" }, + { name: "Cyan", value: "186 94% 42%" }, + // Neutrals + { name: "Slate", value: "215 20% 55%" }, ]; const FONT_WEIGHTS = [ @@ -235,6 +257,8 @@ const SettingsDialog: React.FC = ({ onUpdateKeyBinding, onResetKeyBinding, onResetAllKeyBindings, + customCSS = "", + onCustomCSSChange, }) => { const [importText, setImportText] = useState(""); const [editingBindingId, setEditingBindingId] = useState(null); @@ -477,29 +501,30 @@ const SettingsDialog: React.FC = ({ {/* Appearance Tab */} -
- onThemeChange("light")} - icon={} - label="Light" - /> - onThemeChange("dark")} - icon={} - label="Dark" - /> +
+ +
+ + onThemeChange(v ? "dark" : "light")} + /> + +
+
-
+
{COLORS.map((c) => ( ))} + {/* Custom color picker */} + +
+ + +
+

+ Add custom CSS to personalize the app appearance. Changes apply immediately. +

+