File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1515 }
1616 </style >
1717 {%- endif %}
18+ <script >
19+ const theme = localStorage .getItem (' theme' ) || ' system' ;
20+ let current_theme = theme;
1821
22+ if (theme === ' system' ) {
23+ current_theme = window .matchMedia (' (prefers-color-scheme: dark)' ).matches ? ' dark' : ' light' ;
24+ document .documentElement .setAttribute (' color-theme' , ' system' );
25+ } else {
26+ document .documentElement .setAttribute (' color-theme' , theme);
27+ }
28+
29+ document .documentElement .classList .toggle (' dark' , current_theme === ' dark' );
30+ </script >
1931</head >
2032<body class =" bg-gray-100 text-gray-900 dark:text-gray-200 dark:bg-gray-900" data-dashboard =" {{ current }}" >
2133<header class =" grid md:grid-cols-3 p-4 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700" >
You can’t perform that action at this time.
0 commit comments