Customize the color of the day
Is there a way, or could there be a way, to customize the color of the day? Instead of the standard 'blue'?
I understand that a day is only colored if it has events, and there can be multiple events per day... but similarly how we can pass in a 'badgeColor' for a day, could we pass in a 'dayColor' for the entire block?
Comments (5)
-
repo owner -
Account Deleted reporter Yes I realize I could target
.day.active a { background-color: something-other-than-blue; }
And change the colors of all the days for the calendar.
But what I'm referring to is the ability to color one day one color, and another day another. This could be easily done if I could simply pass in another class to the day, e.g. a 'dayColor' or 'dayClass'.
Then I could set something up like this:
.day.active a.day-success { background-color: green; } .day.active a.day-danger { background-color: red; }
etc.
-
Account Deleted reporter I was able to accomplish exactly this by passing in a
dayClass
property when creating an even for a day. Then, in theCalendar.prototype.addOthers
function, I added the following line:... if (dayEvents.url) { day.find("a").attr("href", dayEvents.url); } // Added by brazilianldsjaguar if (dayEvents.dayClass) { day.find("a").addClass(dayEvents.dayClass); } ...
And then, on initialization (or edit calls) for events, I can do something like this:
$('.responsive-calendar').responsiveCalendar( { events: { '2015-06-14': { 'dayClass': 'day-success' } } } );
-
Account Deleted reporter Actually, I just realized this is already supported:
events: { '2015-06-14': { 'class': 'day-success' } }
Will add the 'day-success' class to the
.day
objects. My apologies for the confusion! -
Account Deleted reporter - changed status to invalid
Functionality already exists.
- Log in to comment
All colors can be setup using css stylesheets by targeting the specific classes in html.