diff --git a/api/classes/organizr.class.php b/api/classes/organizr.class.php
index 92abe5f43..ce25b1d74 100644
--- a/api/classes/organizr.class.php
+++ b/api/classes/organizr.class.php
@@ -862,6 +862,32 @@ public function setTheme($theme = null, $rootPath = '')
$theme = $theme ?? $this->config['theme'];
return '';
}
+
+ public function setScheme()
+ {
+ return '
+
+
+ ';
+ }
public function pluginFiles($type, $settings = false, $rootPath = '')
{
@@ -1807,7 +1833,9 @@ public function getCustomizeAppearance()
$this->settingsOption('color', 'buttonColor', ['label' => 'Button Color']),
$this->settingsOption('color', 'buttonTextColor', ['label' => 'Button Text Color']),
$this->settingsOption('select', 'theme', ['label' => 'Theme', 'class' => 'themeChanger', 'options' => $this->getThemes()]),
- $this->settingsOption('select', 'style', ['label' => 'Style', 'class' => 'styleChanger', 'options' => [['name' => 'Light', 'value' => 'light'], ['name' => 'Dark', 'value' => 'dark'], ['name' => 'Horizontal', 'value' => 'horizontal']]]),
+ $this->settingsOption('select', 'style', ['label' => 'Style', 'class' => 'styleChanger', 'attr' => $this->config['autoDarkMode'] ? 'disabled' : '','options' => [['name' => 'Light', 'value' => 'light'], ['name' => 'Dark', 'value' => 'dark'], ['name' => 'Horizontal', 'value' => 'horizontal']]]),
+ $this->settingsOption('blank'),
+ $this->settingsOption('switch', 'autoDarkMode', ['label' => 'Automatic Dark Mode','class' => $this->config['autoDarkMode'] ? 'on' : '','help' => 'Follows system settings. Style setting will be ignored.', 'attr' => 'onchange="$(this).toggleClass(\'on\'); if ($(this).hasClass(\'on\')){ $auto_dark_mode = true; update_color_scheme(); $(\'.styleChanger[name=style]\').prop(\'disabled\',true); } else { $auto_dark_mode = false; update_color_scheme(\''.$this->config['style'].'\'); $(\'.styleChanger[name=style]\').prop(\'disabled\',false);}"']),
],
'Notifications' => [
$this->settingsOption('select', 'notificationBackbone', ['label' => 'Type', 'class' => 'notifyChanger', 'options' => $this->notificationTypesOptions()]),
@@ -6739,4 +6767,4 @@ protected function processQueries(array $request, $migration = false)
return count($request) > 1 ? $results : $results[$firstKey];
}
-}
\ No newline at end of file
+}
diff --git a/api/config/default.php b/api/config/default.php
index 8953a7976..469a3cdc0 100644
--- a/api/config/default.php
+++ b/api/config/default.php
@@ -33,6 +33,7 @@
'lockScreen' => false,
'theme' => 'Organizr',
'style' => 'dark',
+ 'autoDarkMode' => false,
'plexURL' => '',
'plexTabURL' => '',
'plexToken' => '',
diff --git a/api/v2/routes/root.php b/api/v2/routes/root.php
index e47028b30..b23af0e5e 100644
--- a/api/v2/routes/root.php
+++ b/api/v2/routes/root.php
@@ -127,6 +127,7 @@
$GLOBALS['api']['response']['data']['branch'] = $Organizr->config['branch'];
$GLOBALS['api']['response']['data']['theme'] = $Organizr->config['theme'];
$GLOBALS['api']['response']['data']['style'] = $Organizr->config['style'];
+ $GLOBALS['api']['response']['data']['darkmode'] = $Organizr->config['autoDarkMode'];
$GLOBALS['api']['response']['data']['version'] = $Organizr->version;
$GLOBALS['api']['response']['data']['settings'] = $Organizr->organizrSpecialSettings();
$GLOBALS['api']['response']['data']['plugins'] = $Organizr->pluginGlobalList();
@@ -138,4 +139,4 @@
return $response
->withHeader('Content-Type', 'application/json;charset=UTF-8')
->withStatus($GLOBALS['responseCode']);
-});
\ No newline at end of file
+});
diff --git a/index.php b/index.php
index 9bb652199..94c3ebbc2 100644
--- a/index.php
+++ b/index.php
@@ -254,7 +254,8 @@ class="fa fa-check text-success">
echo $Organizr->formKey();
echo $Organizr->loadCalendarJS();
echo $Organizr->CBPFWTabs();
+echo $Organizr->setScheme();
?>