Initial Commit

This commit is contained in:
Draculabo committed 2025-12-23 01:38:53 +08:00
commit d0417339c1
158 files changed
+31368

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import { os } from "@orpc/server";
import { nativeTheme } from "electron";
import { setThemeModeInputSchema } from "./schemas";
export const getCurrentThemeMode = os.handler(() => {
return nativeTheme.themeSource;
});
export const toggleThemeMode = os.handler(() => {
if (nativeTheme.shouldUseDarkColors) {
nativeTheme.themeSource = "light";
} else {
nativeTheme.themeSource = "dark";
}
return nativeTheme.shouldUseDarkColors;
});
export const setThemeMode = os
.input(setThemeModeInputSchema)
.handler(({ input: mode }) => {
switch (mode) {
case "light":
nativeTheme.themeSource = "light";
break;
case "dark":
nativeTheme.themeSource = "dark";
break;
case "system":
nativeTheme.themeSource = "system";
break;
}
return nativeTheme.themeSource;
});
+8
View File
@@ -0,0 +1,8 @@
import { getCurrentThemeMode, setThemeMode, toggleThemeMode } from './handlers';
import { os } from '@orpc/server';
export const theme = os.router({
getCurrentThemeMode,
setThemeMode,
toggleThemeMode,
});
+3
View File
@@ -0,0 +1,3 @@
import { z } from "zod";
export const setThemeModeInputSchema = z.enum(["light", "dark", "system"]);