Reputation: 23
How can I change the date cell background colour, not only events background colour?
fullcalendar only has have background colour for events in the documents.
Upvotes: 1
Views: 4151
Reputation: 5008
You need to set the color on the Event Source Object
Like the following
eventSources: [
{
url: 'api/holidays',
color: 'yellow' // This is where you set the cell color
},
This makes all my holidays yellow..
UPDATE:
I've set
on all eventObjects coming from that source.
Upvotes: 1
Reputation: 12343
Although I don't know the fullcalendar components in detail, try the following:
You are done but perhaps you want more customization (e.g. have a fixed numbers of colors you'd use, as Ionic or Twitter Bootstrap), you could start the same selector several times adding additional classes for the colors.
Assume your calendar has a structure like this:
<div class="full-calendar">
...
<div class="column" ng-repeat="day in daysOfMonth">
...
<div class="cell" ng-repeat="half_hour in halfHoursOfDay">
...
</div>
</div>
</div>
Your selector would be something like this:
div.full-calendar > div.column > div.cell
And you'd use like this:
div.full-calendar > div.column > div.cell {
background-color: #ff7733;
}
And if perhaps you'd like to use several different colors, you could define several discriminator classes in two different ways:
Providing the full-calendar directive lets you add custom classes, you add your-custom-class to the directive, and define it like this in your selector:
div.full-calendar.your-custom-class > div.column > div.cell {
background-color: #ff8877;
}
/* you should study the generated structure to check whether your custom class is added exactly there, or where, and customize the selector you want */
If you can't directly add custom classes by a mean provided by the directive, you always can wrap the element and customize it:
<!-- html -->
<div style="display: inline-block" class="your-custom-class">
<your-full-calendar-directive-here />
</div>
/* css */
.your-custom-class div.full-calendar > div.column > div.cell {
background-color: #ff8877;
}
Summary: No. I don't know the library you are trying to use, but if you're not able to customize UI by provided means, you can always fall back to define your custom styles.
Notes: You will not be able to pass arbitrary colors but colors backed by classes you create in css styles (unless you find a way to do it with jquery in the appropriate moment).
Upvotes: 0