File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 55 < meta charset ="UTF-8 ">
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
77 < title > Multi-Object Detection using YOLO</ title >
8- <!-- Theme detection before any rendering -->
8+
9+ <!-- Theme detection - BEFORE CSS to prevent flash -->
910 < script >
10- const theme = localStorage . getItem ( 'theme' ) ;
11- if ( theme === 'dark' ) {
12- document . documentElement . classList . add ( 'dark' ) ;
13- }
11+ ( function ( ) {
12+ const savedTheme = localStorage . getItem ( 'theme' ) ;
13+ const prefersDark = window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ;
14+
15+ if ( savedTheme === 'dark' || ( prefersDark && ! savedTheme ) ) {
16+ document . documentElement . classList . add ( 'dark' ) ;
17+ }
18+ } ) ( ) ;
1419 </ script >
20+
1521 < link rel ="stylesheet " href ="style.css ">
1622 <!-- Load TensorFlow.js and COCO-SSD -->
1723 < script src ="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest "> </ script >
You can’t perform that action at this time.
0 commit comments