File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 42
42
'title ' => null ,
43
43
44
44
/*
45
- * Define the theme of the documentation. Available options are `light` and `dark `.
45
+ * Define the theme of the documentation. Available options are `light`, `dark`, and `system `.
46
46
*/
47
47
'theme ' => 'light ' ,
48
48
Original file line number Diff line number Diff line change 65
65
docs .apiDescriptionDocument = @json ($spec );
66
66
})();
67
67
< / script>
68
+
69
+ @if ($config -> get (' ui.theme' , ' light' ) === ' system' )
70
+ < script>
71
+ var mediaQuery = window .matchMedia (' (prefers-color-scheme: dark)' );
72
+
73
+ function updateTheme (e ) {
74
+ if (e .matches ) {
75
+ window .document .documentElement .setAttribute (' data-theme' , ' dark' );
76
+ window .document .getElementsByName (' color-scheme' )[0 ].setAttribute (' content' , ' dark' );
77
+ } else {
78
+ window .document .documentElement .setAttribute (' data-theme' , ' light' );
79
+ window .document .getElementsByName (' color-scheme' )[0 ].setAttribute (' content' , ' light' );
80
+ }
81
+ }
82
+
83
+ mediaQuery .addEventListener (' change' , updateTheme);
84
+ updateTheme (mediaQuery);
85
+ < / script>
86
+ @endif
68
87
< / body>
69
88
< / html>
You can’t perform that action at this time.
0 commit comments