File tree 1 file changed +4
-3
lines changed
docs/.vuepress/components
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -36,21 +36,22 @@ interface ProjCardDevProps {
36
36
37
37
const props = defineProps <ProjCardDevProps >();
38
38
39
- function isDarkTheme(): boolean {
39
+ function isDarkTheme(): boolean | null {
40
40
const theme = useLocalStorage <" auto" | " dark" | " light" >(" vuepress-theme-hope-scheme" , " auto" );
41
- // window is not defined in SSR
42
- if (theme .value === " auto" && typeof window === " undefined" ) return false ;
41
+ if (theme .value === " auto" && typeof window === " undefined" ) return null ;
43
42
return theme .value === " auto"
44
43
? window .matchMedia (" (prefers-color-scheme: dark)" ).matches
45
44
: theme .value === " dark" ;
46
45
}
47
46
48
47
const contentBg = computed (() => {
49
48
const theme = isDarkTheme ();
49
+ if (theme === null ) return " transparent" ;
50
50
return theme ? " #333333" : " #ffffff" ;
51
51
});
52
52
const shadowColor = computed (() => {
53
53
const theme = isDarkTheme ();
54
+ if (theme === null ) return " rgba(0,0,0,0.48)" ;
54
55
return theme ? " rgba(255,223,0,0.48)" : " #d9d9d9" ;
55
56
});
56
57
You can’t perform that action at this time.
0 commit comments