From 63191dab7d5b4572f243bff03a0edf5308549498 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 12:03:19 +0200 Subject: [PATCH] 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'));