A new option `dark_style` is introduced to set which dark theme administrators want to user.
If administrator don"t want to use a dark mode, they can just set `dark_syle` and `style` option to the same value.
closes #305
Signed-off-by: Jerome Jutteau <jerome@jutteau.fr>
5. Follow the installation wizard, it should propose you the same data folder or even update automatically
6. Check your `/lib/config.local.php` and compare it with the `/lib/config.original.php` to see if new configuration items are available. If a new item is missing in your `config.local.php`, this may trigger some errors as Jirafeau may expect to have them.
-# version 4.5
+# version 4.5.0
+- Support for dark theme
- Fix side effects of setting too high values in php configuration.
New configuration items:
-- `max_upload_chunk_size_bytes` option
+- `max_upload_chunk_size_bytes` option
+- `dark_tyle` option
# version 4.4.0
/* Select a theme - see media folder for available themes
*/
$cfg['style'] = 'courgette';
+$cfg['dark_style'] = 'dark-courgette';
/* Name the organisation running this installation, eg. 'ACME'
*/
copyLinkToClipboard(link_id);});
}
}
+
+function set_dark_mode() {
+ let steel_sheet = "<?php echo 'media/' . $cfg['dark_style'] . '/style.css.php'; ?>";
+ let shortcut_icon = "<?php echo 'media/' . $cfg['dark_style'] . '/favicon.ico'; ?>";
+ document.getElementById('stylesheet').href = steel_sheet;
+ document.getElementById('shortcut_icon').href = steel_sheet;
+}
+
+function set_light_mode() {
+ let steel_sheet = "<?php echo 'media/' . $cfg['style'] . '/style.css.php'; ?>";
+ let shortcut_icon = "<?php echo 'media/' . $cfg['style'] . '/favicon.ico'; ?>";
+ document.getElementById('stylesheet').href = steel_sheet;
+ document.getElementById('shortcut_icon').href = steel_sheet;
+}
+
+function color_scheme_preferences() {
+
+ let dark_mode_steel_sheet = "<?php echo 'media/' . $cfg['dark_style'] . '/style.css.php'; ?>"
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
+ set_dark_mode();
+ } else {
+ set_light_mode();
+ }
+
+ // When user change its preference
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', lightMode => {
+ lightMode.matches ? set_dark_mode() : set_light_mode();
+ });
+}
+
// @license-end
<head>
<meta charset="utf-8">
<title><?php echo (true === empty($cfg['title']))? t('JI_WEB_RE') : $cfg['title']; ?></title>
- <link rel="shortcut icon" href="<?php echo 'media/' . $cfg['style'] . '/favicon.ico'; ?>">
- <link href="<?php echo 'media/' . $cfg['style'] . '/style.css.php'; ?>" rel="stylesheet" type="text/css" />
+ <link id="shortcut_icon" rel="shortcut icon" href="<?php echo 'media/' . $cfg['style'] . '/favicon.ico'; ?>">
+ <link id="stylesheet" rel="stylesheet" href="<?php echo 'media/' . $cfg['style'] . '/style.css.php'; ?>" type="text/css" />
</head>
<body>
<script type="text/javascript" src="<?php echo 'lib/functions.js.php'; ?>"></script>
+<script type="text/javascript" lang="Javascript">color_scheme_preferences();</script>
<div id="content">
<h1>
<a href="./">