Search code examples
fullcalendarfullcalendar-scheduler

change color per day at an event a few days FULLCALENDAR


I'm using fullcalendar to show events from database but on the same event I want to some days red(danger) and some days blue(default) in accordance with a fields on database. Is it possible?


Solution

  • Yes you can. You can specify color in your events to change color. Example:

      [
        [
            title: Red,
            color: #DC143C
        ],
        [
            title: Blue,
            color: #00FFFF
        ]
    ]
    

    You can also change it dynamically using eventRender callback as following example:

        eventRender: function(event, element) {
                    if(event.title=="Red")
                        element.css('background-color', '#DC143C');
                    if(event.title=="Blue")
                        element.css('background-color', '#00FFFF');
    

    }