aboutsummaryrefslogtreecommitdiffstats
path: root/apps/browser-extension/src/utils/settings.ts
diff options
context:
space:
mode:
authorqixing-jk <street-anime-olive@duck.com>2025-09-07 22:06:28 +0800
committerGitHub <noreply@github.com>2025-09-07 15:06:28 +0100
commit44bc838f6aeb4ac5b1f7f67e47edb4fd10286733 (patch)
tree26412791ff96dbf8de56defb0daf7004ac08e3bc /apps/browser-extension/src/utils/settings.ts
parent4362663dcf26a23cb222b501e0e3056906651245 (diff)
downloadkarakeep-44bc838f6aeb4ac5b1f7f67e47edb4fd10286733.tar.zst
feat(extension): Add theme and dynamic icon support (#1894)
* feat: add theme selection support to browser extension - integrate theme settings with plugin settings storage - add theme selector dropdown to options page - implement custom ThemeProvider using plugin settings - include new Select UI component for theme selection * feat(extension): add dynamic icon theme switching (#1100) Add updateIcon() function to dynamically change extension icon based on selected theme (light/dark/system). Update icon on initial load and when settings change to reflect current theme preference. Closes #1100 * fix(extension): switch dark mode strategy from media to selector This allows manual control over dark mode via class toggling rather than relying on the OS/browser preference. * fix(extension): move icon update logic to content script The `window` object is inaccessible in the background script, causing icon updates to fail. This change relocates the icon update logic to the content script where `window.matchMedia` is available. - Remove `updateIcon` function from background script - Add icon update logic to `ThemeProvider` component - Consolidate theme and icon updates in single effect * feat(settings): make theme field required in settings schema Remove optional flag from theme field to enforce presence in settings validation schema. * deps: Upgrade the extension deps * minor fixes --------- Co-authored-by: MohamedBassem <me@mbassem.com>
Diffstat (limited to 'apps/browser-extension/src/utils/settings.ts')
-rw-r--r--apps/browser-extension/src/utils/settings.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/browser-extension/src/utils/settings.ts b/apps/browser-extension/src/utils/settings.ts
index c273acfa..523699b4 100644
--- a/apps/browser-extension/src/utils/settings.ts
+++ b/apps/browser-extension/src/utils/settings.ts
@@ -5,11 +5,13 @@ const zSettingsSchema = z.object({
apiKey: z.string(),
apiKeyId: z.string().optional(),
address: z.string(),
+ theme: z.enum(["light", "dark", "system"]).optional().default("system"),
});
const DEFAULT_SETTINGS: Settings = {
apiKey: "",
address: "",
+ theme: "system",
};
export type Settings = z.infer<typeof zSettingsSchema>;