diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 15d16dbff41..835e3501b87 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -506,10 +506,13 @@ if ($conf->global->ENABLE_AGENDA_EXT==1 && $conf->global->AGENDA_EXT_NB>0)
$event=new ActionComm($db);
$paramkey='AGENDA_EXT_NAME'.$i;
$namecal = $conf->global->$paramkey;
+ $paramkey='AGENDA_EXT_COLOR'.$i;
+ $colorcal = $conf->global->$paramkey;
$event->id=$namecal;
$event->datep=$icalevent[DTSTART];
$event->datef=$icalevent[DTEND];
$event->type_code="ICALEVENT";
+ $event->type_id = $colorcal;
$event->libelle=''.$icalevent[SUMMARY].'
'.dol_nl2br($icalevent[DESCRIPTION],1,false);
//$event->fulldayevent=$obj->fulldayevent;
@@ -798,8 +801,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$colorindex=0;
if ($event->author->id == $user->id || $event->usertodo->id == $user->id || $event->userdone->id == $user->id) $colorindex=1;
if ($event->type_code == 'BIRTHDAY') $colorindex=2;
- $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
+ if ($event->type_code == 'ICALEVENT') $color=$event->type_id;
+ else $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
//print "x".$color;
+
print '
| '; if ($event->type_code != 'BIRTHDAY') |