NEW #21395 : Added option for dark theme mode in display - color and theme

This commit is contained in:
Faustin 2022-06-27 16:08:06 +02:00
parent 35187e2e2f
commit d7d02fee9a
4 changed files with 50 additions and 10 deletions

View File

@ -104,6 +104,16 @@ if ($action == 'update') {
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
$val = GETPOST('THEME_DARKMODEENABLED');
if (!$val) {
dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
}
if ($val) {
dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
}
}
if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) { if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE'); $val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
if (!$val) { if (!$val) {

View File

@ -455,6 +455,27 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
} }
//Dark mode
if ($foruserprofile) {
//Nothing
} else {
$listofdarkmodes = array(
'0' => $langs->trans("AlwaysDisabled"),
'1' => $langs->trans("AccordingToBrowser"),
'2' => $langs->trans("AlwaysEnabled")
);
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DarkThemeMode").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print $form->selectarray('THEME_DARKMODEENABLED', $listofdarkmodes, isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0);
} else {
print $listofdarkmodes[isset($conf->global->THEME_DARKMODEENABLED) ? $conf->global->THEME_DARKMODEENABLED : 0];
}
print '</tr>';
}
// TopMenuDisableImages // TopMenuDisableImages
if ($foruserprofile) { if ($foruserprofile) {
/* /*

View File

@ -2277,3 +2277,8 @@ INVOICE_ADD_ZATCA_QR_CODEMore=Some Arabic countries need this QR Code on their i
INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices
UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID. UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
IfThisCategoryIsChildOfAnother=If this category is a child of another one IfThisCategoryIsChildOfAnother=If this category is a child of another one
DarkThemeMode=Dark theme mode
AlwaysDisabled=Always disabled
AccordingToBrowser=According to browser
AlwaysEnabled=Always Enabled

View File

@ -2263,3 +2263,7 @@ IconOnly=Icon only - Text on tooltip only
INVOICE_ADD_ZATCA_QR_CODE=Show the ZATCA QR code on invoices INVOICE_ADD_ZATCA_QR_CODE=Show the ZATCA QR code on invoices
INVOICE_ADD_ZATCA_QR_CODEMore=Some Arabic countries need this QR Code on their invoices INVOICE_ADD_ZATCA_QR_CODEMore=Some Arabic countries need this QR Code on their invoices
UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID. UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
DarkThemeMode=Mode thème sombre
AlwaysDisabled=Toujours désactivé
AccordingToBrowser=Selon le navigateur
AlwaysEnabled=Toujours activé