File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 108
108
navigator . serviceWorker . register ( "scripts/serviceworker.js" ) ;
109
109
}
110
110
111
+ // Check theme to set status bar color
112
+ changeThemeColor ( "#ffffff" , "#000000" ) ;
113
+
111
114
// Check if location permission is given
112
115
navigator . permissions . query ( { name : "geolocation" } ) . then ( result => {
113
116
if ( result . state === "granted" ) {
Original file line number Diff line number Diff line change @@ -94,8 +94,10 @@ function parseMillisecondsIntoTripTime(milliseconds, showSeconds = true) {
94
94
return ( absoluteHours > 0 ? h + "h" : "" ) + m + "m" + ( showSeconds ? s + "s" : "" ) ;
95
95
}
96
96
97
- function changeThemeColor ( color ) {
98
- metaThemeColor = document . querySelector ( "meta[name=theme-color]" ) . setAttribute ( "content" , color ) ;
97
+ function changeThemeColor ( color , darkModeColor = null ) {
98
+ isDarkMode ( ) && darkModeColor
99
+ ? document . querySelector ( "meta[name=theme-color]" ) . setAttribute ( "content" , darkModeColor )
100
+ : document . querySelector ( "meta[name=theme-color]" ) . setAttribute ( "content" , color ) ;
99
101
}
100
102
101
103
function downloadObjectAsJson ( exportObj , exportName ) {
@@ -108,6 +110,10 @@ function downloadObjectAsJson(exportObj, exportName) {
108
110
downloadAnchorNode . remove ( ) ;
109
111
}
110
112
113
+ function isDarkMode ( ) {
114
+ return window . matchMedia && window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches ;
115
+ }
116
+
111
117
function getTLD ( ) {
112
118
let hostname = window . location . hostname ;
113
119
Original file line number Diff line number Diff line change @@ -282,7 +282,7 @@ function hideUserSettings() {
282
282
userSettings . classList . add ( "smooth-slide-to-bottom" ) ;
283
283
setTimeout ( ( ) => userSettings . remove ( ) , 300 ) ; // remove element after animation end
284
284
}
285
- changeThemeColor ( "#ffffff" ) ; // Set status bar color in PWA
285
+ changeThemeColor ( "#ffffff" , "#000000" ) ; // Set status bar color in PWA
286
286
}
287
287
288
288
function openSetProxyPrompt ( ) {
@@ -480,7 +480,7 @@ function openStatisticsMenu() {
480
480
updateStatisticsChart ( ) ;
481
481
482
482
// Set status bar color in PWA
483
- changeThemeColor ( "#231f20" ) ;
483
+ changeThemeColor ( "#231f20" , "#1a1517" ) ;
484
484
}
485
485
486
486
function hideStatisticsMenu ( ) {
You can’t perform that action at this time.
0 commit comments