From cafd4fc5997244d427ade2277c56b0781518d736 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 6 Aug 2019 15:24:42 +0200 Subject: [PATCH 1/7] New living color for chart --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/theme/eldy/theme_vars.inc.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 458f0bd4fad..5c45eb5836d 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1094,7 +1094,7 @@ class DolGraph $i++; } // shadowSize: 0 -> Drawing is faster without shadows - $this->stringtoshow.="\n".' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6 } }'."\n"; + $this->stringtoshow.="\n".' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6, fillColor: { colors: [{opacity: 0.9 }, {opacity: 0.85}] }} }'."\n"; // Xaxis $this->stringtoshow.=', xaxis: { ticks: ['."\n"; diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index f02c25113ef..b050425163e 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -32,7 +32,8 @@ global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $theme_bordercolor = array(235,235,224); -$theme_datacolor = array(array(136,102,136), array(0,130,110), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); + $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); From 7866c2c0d3af5121122f35a142a563e5ed85c4bb Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 6 Aug 2019 15:42:12 +0200 Subject: [PATCH 2/7] change color --- htdocs/theme/eldy/theme_vars.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index b050425163e..4f5708ba556 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -32,7 +32,7 @@ global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $theme_bordercolor = array(235,235,224); -$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +$theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0,166,90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); From 4aeaa580eae40b65059acef11807dbc8d9570048 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 11:11:47 +0200 Subject: [PATCH 3/7] Add color blind option --- htdocs/core/lib/usergroups.lib.php | 39 ++++++++++++++++++++++++++++++ htdocs/langs/en_US/admin.lang | 5 ++++ htdocs/user/param_ihm.php | 6 +++++ 3 files changed, 50 insertions(+) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 7da112fa255..630ad5c796e 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -947,5 +947,44 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false) */ } + + // Use MAIN_OPTIMIZEFORTEXTBROWSER + if ($foruserprofile) + { + //$default=yn($conf->global->MAIN_OPTIMIZEFORCOLORBLIND); + $default=$langs->trans('No'); + print ''; + print ''.$langs->trans("MAIN_OPTIMIZEFORCOLORBLIND").''; + print ''; + + $colorBlindOptions = array( + 'none' => $langs->trans('No'), + 'protanopia' => $langs->trans('Protanopia'), + 'deuteranopes' => $langs->trans('Deuteranopes'), + 'tritanopes' => $langs->trans('Tritanopes'), + ); + + if ($edit) + { + print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND, 0); + } + else + { + if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])){ + print $colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND]; + } + else{ + print yn(0); + } + } + print '   ('.$langs->trans("Default").': '.$default.') '; + print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORCOLORBLINDDesc")); + print ''; + print ''; + } + else + { + + } print ''; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0f22d42327c..48d4d898de6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1900,6 +1900,11 @@ OnMobileOnly=On small screen (smartphone) only DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be Prospect or Customer but can't be both) MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or if you use the application from a text browser like Lynx or Links. +MAIN_OPTIMIZEFORCOLORBLIND=Change interface's color for color blind person +MAIN_OPTIMIZEFORCOLORBLINDDesc=Enable this option if you are a color blind person, in some case interface will change color setup to increase contrast. +Protanopia=Protanopia +Deuteranopes=Deuteranopes +Tritanopes=Tritanopes ThisValueCanOverwrittenOnUserLevel=This value can be overwritten by each user from its user page - tab '%s' DefaultCustomerType=Default thirdparty type for "New customer" creation form ABankAccountMustBeDefinedOnPaymentModeSetup=Note: The bank account must be defined on the module of each payment mode (Paypal, Stripe, ...) to have this feature working. diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 90228aa952e..c33c26fa95b 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -152,6 +152,12 @@ if (empty($reshook)) { $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 0; } + if (GETPOST('MAIN_OPTIMIZEFORCOLORBLIND')) { + $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = GETPOST('MAIN_OPTIMIZEFORCOLORBLIND'); + } else { + $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = 0; + } + $result = dol_set_user_param($db, $conf, $object, $tabparam); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); From 63191dab7d5b4572f243bff03a0edf5308549498 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 12:03:19 +0200 Subject: [PATCH 4/7] Add user color blind option --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/theme/eldy/theme_vars.inc.php | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 5c45eb5836d..6bc20742821 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -96,7 +96,7 @@ class DolGraph */ public function __construct($library = 'jflot') { - global $conf; + global $conf, $user; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor; // To use old feature diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 630ad5c796e..ea7f9856509 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -958,7 +958,7 @@ function show_theme($fuser, $edit = 0, $foruserprofile = false) print ''; $colorBlindOptions = array( - 'none' => $langs->trans('No'), + 0 => $langs->trans('No'), 'protanopia' => $langs->trans('Protanopia'), 'deuteranopes' => $langs->trans('Deuteranopes'), 'tritanopes' => $langs->trans('Tritanopes'), diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 4f5708ba556..1fc1acb32bc 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -30,9 +30,14 @@ * if (is_readable($var_file)) include $var_file; */ -global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; +global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet, $user; $theme_bordercolor = array(235,235,224); $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0,166,90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +if(!empty($user) && !empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by graph +{ + // for now we use the same configuration for all types of color blind + $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(120,120,120), array(253, 205, 102), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +} $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); From 401dc12b939c1e9c1ac4903db6dab1ae5f1bd358 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 12:15:55 +0200 Subject: [PATCH 5/7] Add color blind option in body for css impact --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/main.inc.php | 7 +++++++ htdocs/theme/eldy/theme_vars.inc.php | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 6bc20742821..5c45eb5836d 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -96,7 +96,7 @@ class DolGraph */ public function __construct($library = 'jflot') { - global $conf, $user; + global $conf; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor; // To use old feature diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7b983ca05eb..e1a1f333d1d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -902,6 +902,9 @@ elseif (! empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER=$user->conf->MAIN_OPTIMIZEFORTEXTBROWSER; } +// set MAIN_OPTIMIZEFORCOLORBLIND +$conf->global->MAIN_OPTIMIZEFORCOLORBLIND=$user->conf->MAIN_OPTIMIZEFORCOLORBLIND; + // Set terminal output option according to conf->browser. if (GETPOST('dol_hide_leftmenu', 'int') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1; if (GETPOST('dol_hide_topmenu', 'int') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1; @@ -1087,6 +1090,10 @@ if (! function_exists("llxHeader")) if ($mainmenu != 'website') $tmpcsstouse=$morecssonbody; // We do not use sidebar-collpase by default to have menuhider open by default. } + if(!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)){ + $tmpcsstouse.= ' colorblind-'.strip_tags($conf->global->MAIN_OPTIMIZEFORCOLORBLIND); + } + print '' . "\n"; // top menu and left menu area diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 1fc1acb32bc..a1ff5120c27 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -30,10 +30,10 @@ * if (is_readable($var_file)) include $var_file; */ -global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet, $user; +global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $theme_bordercolor = array(235,235,224); $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0,166,90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); -if(!empty($user) && !empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by graph +if(!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php { // for now we use the same configuration for all types of color blind $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(120,120,120), array(253, 205, 102), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); From 450878cd92bacf2498eff0a9c3a005595f483c4f Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 15:13:59 +0200 Subject: [PATCH 6/7] Fix color deuteranopia --- htdocs/theme/eldy/theme_vars.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index a1ff5120c27..5472d5283f5 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -36,7 +36,7 @@ $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190, if(!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php { // for now we use the same configuration for all types of color blind - $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(120,120,120), array(253, 205, 102), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); + $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85,135,150), array(150,135,80), array(150,80,150)); } $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); From af4d5aa549508ef6d71cdfabf915e1110493162a Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 17:22:59 +0200 Subject: [PATCH 7/7] Fix color badges and status for color blind --- htdocs/theme/eldy/badges.inc.php | 107 ++++++++++++++++++--------- htdocs/theme/eldy/theme_vars.inc.php | 11 +++ 2 files changed, 81 insertions(+), 37 deletions(-) diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index 984315b0bde..0f635941a8e 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -115,6 +115,17 @@ a.badge-warning:focus, a.badge-warning:hover { background-color: ; } +/* WARNING colorblind */ +body[class^="colorblind-"] .badge-warning { + background-color: ; + } +body[class^="colorblind-"] a.badge-warning.focus,body[class^="colorblind-"] a.badge-warning:focus { + box-shadow: 0 0 0 0.2rem ; +} +body[class^="colorblind-"] a.badge-warning:focus, a.badge-warning:hover { + background-color: ; +} + /* INFO */ .badge-info { color: #fff !important; @@ -160,44 +171,66 @@ a.badge-dark:focus, a.badge-dark:hover { /* * STATUS BADGES */ - -/* Default Status */ - expemple $badgeStatusValidate, $badgeStatusClosed, $badgeStatusActive .... @@ -91,3 +96,9 @@ $badgeStatus6='#cad2d2'; $badgeStatus7='#baa32b'; $badgeStatus8='#be3013'; $badgeStatus9='#e7f0f0'; + +// status color ajustement for color blind +$colorblind_deuteranopes_badgeStatus4=$colorblind_deuteranopes_badgeStatus7=$colorblind_deuteranopes_badgeSuccess; //! text color black +$colorblind_deuteranopes_badgeStatus_textColor4=$colorblind_deuteranopes_badgeStatus_textColor7='#000'; +$colorblind_deuteranopes_badgeStatus1=$colorblind_deuteranopes_badgeWarning; +$colorblind_deuteranopes_badgeStatus_textColor1='#000';