NEW Can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
This commit is contained in:
parent
d08c42a205
commit
8aa968a27c
@ -850,13 +850,13 @@ if (GETPOST('theme', 'alpha'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set javascript option
|
// Set javascript option
|
||||||
if (!GETPOST('nojs', 'int')) // If javascript was not disabled on URL
|
if (GETPOST('nojs', 'int')) { // If javascript was not disabled on URL
|
||||||
{
|
$conf->use_javascript_ajax = 0;
|
||||||
if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT))
|
} else {
|
||||||
{
|
if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) {
|
||||||
$conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
|
$conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
|
||||||
}
|
}
|
||||||
} else $conf->use_javascript_ajax = 0;
|
}
|
||||||
|
|
||||||
// Set MAIN_OPTIMIZEFORTEXTBROWSER for user (must be after login part)
|
// Set MAIN_OPTIMIZEFORTEXTBROWSER for user (must be after login part)
|
||||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||||
@ -1233,6 +1233,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
|
|||||||
if (GETPOSTISSET('dol_optimize_smallscreen')) { $themeparam .= '&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int'); }
|
if (GETPOSTISSET('dol_optimize_smallscreen')) { $themeparam .= '&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int'); }
|
||||||
if (GETPOSTISSET('dol_no_mouse_hover')) { $themeparam .= '&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int'); }
|
if (GETPOSTISSET('dol_no_mouse_hover')) { $themeparam .= '&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int'); }
|
||||||
if (GETPOSTISSET('dol_use_jmobile')) { $themeparam .= '&dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int'); $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); }
|
if (GETPOSTISSET('dol_use_jmobile')) { $themeparam .= '&dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int'); $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); }
|
||||||
|
if (GETPOSTISSET('THEME_DARKMODEENABLED')) { $themeparam .= '&THEME_DARKMODEENABLED='.GETPOST('THEME_DARKMODEENABLED', 'int'); }
|
||||||
if (GETPOSTISSET('THEME_SATURATE_RATIO')) { $themeparam .= '&THEME_SATURATE_RATIO='.GETPOST('THEME_SATURATE_RATIO', 'int'); }
|
if (GETPOSTISSET('THEME_SATURATE_RATIO')) { $themeparam .= '&THEME_SATURATE_RATIO='.GETPOST('THEME_SATURATE_RATIO', 'int'); }
|
||||||
|
|
||||||
if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax)
|
if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax)
|
||||||
|
|||||||
@ -15,9 +15,12 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
|||||||
}
|
}
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (!empty($conf->global->MAIN_THEME_DARKMODEENABLED)) {
|
if (!empty($conf->global->THEME_DARKMODEENABLED)) {
|
||||||
|
print "/* For dark mode */\n";
|
||||||
|
if ($conf->global->THEME_DARKMODEENABLED != 2) {
|
||||||
|
print "@media (prefers-color-scheme: dark) {";
|
||||||
|
}
|
||||||
print "
|
print "
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
:root {
|
||||||
|
|
||||||
--btncolortext: ;
|
--btncolortext: ;
|
||||||
@ -27,8 +30,10 @@ if (!empty($conf->global->MAIN_THEME_DARKMODEENABLED)) {
|
|||||||
--butactionbg:rgb(173,140,79);
|
--butactionbg:rgb(173,140,79);
|
||||||
--butactiondeletebg: rgb(252,84,91);
|
--butactiondeletebg: rgb(252,84,91);
|
||||||
|
|
||||||
}
|
}\n";
|
||||||
}";
|
if ($conf->global->THEME_DARKMODEENABLED != 2) {
|
||||||
|
print "}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@ -45,10 +45,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (!empty($conf->global->MAIN_THEME_DARKMODEENABLED)) {
|
if (!empty($conf->global->THEME_DARKMODEENABLED)) {
|
||||||
print "@media (prefers-color-scheme: dark) {
|
print "/* For dark mode */\n";
|
||||||
:root {
|
if ($conf->global->THEME_DARKMODEENABLED != 2) {
|
||||||
|
print "@media (prefers-color-scheme: dark) {";
|
||||||
|
}
|
||||||
|
print ":root {
|
||||||
--colorbackhmenu1: #1d1e20;
|
--colorbackhmenu1: #1d1e20;
|
||||||
--colorbackvmenu1: #2b2c2e;
|
--colorbackvmenu1: #2b2c2e;
|
||||||
--colorbacktitle1: #2b2d2f;
|
--colorbacktitle1: #2b2d2f;
|
||||||
@ -84,8 +86,10 @@ if (!empty($conf->global->MAIN_THEME_DARKMODEENABLED)) {
|
|||||||
--amountremaintopaycolor:rgb(252,84,91);
|
--amountremaintopaycolor:rgb(252,84,91);
|
||||||
--amountpaymentcomplete:rgb(101,184,77);
|
--amountpaymentcomplete:rgb(101,184,77);
|
||||||
--amountremaintopaybackcolor:rbg(245,130,46);
|
--amountremaintopaybackcolor:rbg(245,130,46);
|
||||||
}
|
}\n";
|
||||||
}";
|
if ($conf->global->THEME_DARKMODEENABLED != 2) {
|
||||||
|
print "}\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,7 @@ else header('Cache-Control: no-cache');
|
|||||||
|
|
||||||
if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL
|
if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL
|
||||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL
|
||||||
|
if (GETPOST('THEME_DARKMODEENABLED', 'int')) $conf->global->THEME_DARKMODEENABLED = GETPOST('THEME_DARKMODEENABLED', 'int'); // If darkmode was forced on URL
|
||||||
|
|
||||||
$langs->load("main", 0, 1);
|
$langs->load("main", 0, 1);
|
||||||
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
|
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user