Browse Source

Change statusbar color on dark theme

tags/v1.3.0
Skylar Ittner 8 months ago
parent
commit
f0d3b2b4f6
3 changed files with 26 additions and 9 deletions
  1. +2
    -4
      www/js/main.js
  2. +23
    -0
      www/js/platform.js
  3. +1
    -5
      www/js/settings.js

+ 2
- 4
www/js/main.js View File

@@ -62,13 +62,11 @@ router.on("pageInit", function (pagedata) {
}
});

if (localStorage.getItem("darktheme") == "true") {
$("#app").addClass("theme-dark");
}

// Run platform-specific setup code for Cordova or NW.js
initPlatform();

// Switch to dark theme if requested by user setting
setAppTheme();

if (localStorage.getItem("configured") == null) {
// Open the setup page


+ 23
- 0
www/js/platform.js View File

@@ -22,6 +22,14 @@ var removeTrayMenu = function () {

}

var setAppTheme = function () {
if (localStorage.getItem("darktheme") == "true") {
$("#app").addClass("theme-dark");
} else {
$("#app").removeClass("theme-dark");
}
}

function initCordova() {
platform_type = "cordova";

@@ -46,6 +54,21 @@ function initCordova() {
openBrowser = function (url) {
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
}

setAppTheme = function () {
if (localStorage.getItem("darktheme") == "true") {
$("#app").addClass("theme-dark");
if (cordova.platformId == 'android') {
StatusBar.styleDefault();
}
} else {
$("#app").removeClass("theme-dark");
if (cordova.platformId == 'android') {
StatusBar.backgroundColorByHexString("#D32F2F");
StatusBar.styleLightContent();
}
}
}
}

function initNW() {


+ 1
- 5
www/js/settings.js View File

@@ -14,9 +14,5 @@ $('.item-content[data-setting=darktheme] .toggle input').on("change", function (
var checked = $(this).prop('checked');
localStorage.setItem("darktheme", checked);
if (localStorage.getItem("darktheme") == "true") {
$("#app").addClass("theme-dark");
} else {
$("#app").removeClass("theme-dark");
}
setAppTheme();
});

Loading…
Cancel
Save