Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding nice colors to events in FullCalendar (jquery)

In my calendar I want to colour each event in a different colour. Is there currently a way to send to the full calendar, in the JSON it expects a value for a colour?
FullCalendar

like image 986
Itay Moav -Malimovka Avatar asked May 03 '10 20:05

Itay Moav -Malimovka


1 Answers

Seems I missed it the first time I read the manual:

I send for each day the following JSON:

{"id":"1",
"start":"1272513600",
"end":"1272513600",
"allDay":"1",
"title":"Repeat 1,Day 1",
"className":"eventColorX"}

The important thing is the className and where the X is a number (depends on the CSS, see below).
And then in the CSS:

.eventColor1,
.fc-agenda .eventColor1 .fc-event-time,
.eventColor1 a {
    background-color: green; /* background color */
    border-color: green;     /* border color */
    color: yellow;           /* text color */
    }

.eventColor2,
.fc-agenda .eventColor2 .fc-event-time,
.eventColor2 a {
     background-color: purple; /* background color */
     border-color: purple;     /* border color */
     color: white;           /* text color */
     }


.
.
.
.
like image 97
Itay Moav -Malimovka Avatar answered Sep 20 '22 05:09

Itay Moav -Malimovka