getThemeType hook returns the resolved theme now

This commit is contained in:
Carter 2025-04-15 14:05:08 -06:00
parent 4ff7609493
commit 8b6828ecce

View file

@ -1,8 +1,12 @@
import { useThemeMode } from "./AppThemeProvider";
export type ThemeType = "light" | "dark" | "system";
export function getThemeType(): ThemeType {
let theme = localStorage.getItem("theme");
return theme === "light" ? "light" : "dark";
const themeMode = useThemeMode()
// return localStorage.getItem("theme");
// return theme === "light" ? "light" : "dark";
return themeMode.resolvedMode
}
export function setThemeType(theme: ThemeType) {
@ -10,6 +14,8 @@ export function setThemeType(theme: ThemeType) {
}
export function getThemeMode(): ThemeType {
let theme = localStorage.getItem("theme");
return theme === "light" ? "light" : "dark";
const themeMode = useThemeMode()
// return localStorage.getItem("theme");
// return theme === "light" ? "light" : "dark";
return themeMode.resolvedMode
}