You are here

28 November 2012

You can only change event colors by content type or taxonomy terms in Calendar view. More advanced coloring requires some programming.

Source code viewer
  1. (function($){$().ready(function(){
  2. $('div.view div.calendar-calendar td').each(function(){
  3. // console.log($(this).attr('data-date'));
  4. sendDate = new Date(Date.parse($(this).attr('data-date')))
  5. today = new Date();
  6. today.setHours(0,0,0,0);
  7. // Past
  8. if (sendDate < today) {
  9. $(this).find('div.monthview, div.weekview, div.dayview').css('background', 'grey');
  10. }
  11. // Future
  12. if (sendDate > today) {
  13. $(this).find('div.monthview, div.weekview, div.dayview').css('background', 'green');
  14. }
  15. // Today
  16. if (sendDate == today) {
  17. $(this).find('div.monthview, div.weekview, div.dayview').css('background', 'red');
  18. }
  19. });
  20. });})(jQuery);
Programming Language: Javascript