getThemeType hook returns the resolved theme now
This commit is contained in:
parent
4ff7609493
commit
8b6828ecce
1 changed files with 10 additions and 4 deletions
|
|
@ -1,8 +1,12 @@
|
||||||
|
import { useThemeMode } from "./AppThemeProvider";
|
||||||
|
|
||||||
export type ThemeType = "light" | "dark" | "system";
|
export type ThemeType = "light" | "dark" | "system";
|
||||||
|
|
||||||
export function getThemeType(): ThemeType {
|
export function getThemeType(): ThemeType {
|
||||||
let theme = localStorage.getItem("theme");
|
const themeMode = useThemeMode()
|
||||||
return theme === "light" ? "light" : "dark";
|
// return localStorage.getItem("theme");
|
||||||
|
// return theme === "light" ? "light" : "dark";
|
||||||
|
return themeMode.resolvedMode
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setThemeType(theme: ThemeType) {
|
export function setThemeType(theme: ThemeType) {
|
||||||
|
|
@ -10,6 +14,8 @@ export function setThemeType(theme: ThemeType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getThemeMode(): ThemeType {
|
export function getThemeMode(): ThemeType {
|
||||||
let theme = localStorage.getItem("theme");
|
const themeMode = useThemeMode()
|
||||||
return theme === "light" ? "light" : "dark";
|
// return localStorage.getItem("theme");
|
||||||
|
// return theme === "light" ? "light" : "dark";
|
||||||
|
return themeMode.resolvedMode
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue