How to Color Code SharePoint Calendars

A company wide calendars with multiple user access may be difficult to read if no markers are applied to the calendar items. A common and easy way to make a SharePoint calendars well-organized and usable is to color code event categories.

You can add colors to SharePoint calendars using the following methods:

  • Utilizing a SharePoint calendars’ ability to overlay multiple views.
  • Color coding event categories through creating a calculated column and employing Content editor.
  • No-code way of changing calendar colors with the help of Virto Calendar web part and O365 app.

We are going to overview each of the methods.

Adding Colors to Event Categories with Overlay Feature

  1. First, set up your event categories – add new and remove the default ones if needed. The default SharePoint categories are like: business, holiday, meeting, etc. Open List settings in the Calendar tab, and click the category column. Set up your calendar category values by adding, editing, or deleting as desired, and click Save.
    sharepoint calendars
  2. Next, create a custom calendar view for each event category. In the Calendar List settings, find the list of actual views. We are going to create a new view, so click Create a view > Start from an existing view > Calendar. Give a name to your new view after the relevant event category. Add a filter to show the calendar items when the Category column is equal to your category value. Save the view. Repeat the process for each category.
    sharepoint calendars
  3. Create a blank calendar view to overlay your categories views on its basis. Alternatively, you can modify a default SharePoint calendar instead. Set up a view filter the same way as earlier but leave the category field empty: Category – is equal to – “blank”. Give a name to the view that would indicate the all-views-in-one mode and set the view as default.
    sharepoint calendars
  4. Now it comes to overlay your multiple calendar views. Open the view you created last and set up as default, click Calendar overlays in the Calendar tab.
    sharepoint calendars
    You’re almost added colors to event categories of sharepoint calendars. Next click New calendar, enter the required info into the fields, and name the overlay after the event category, add a description and designate a color.
    sharepoint calendars
    Click Resolve to get the list of available calendar views within your SharePoint site, and select the required view. Repeat the process for each calendar view.

Having created all the overlays, you will see a color-coded SharePoint calendar.
sharepoint calendars
When utilizing the overlay method, you may meet the troubles like overlay restriction to 10 and duplicate events. To manage the first issue you should turn to third party solutions like Virto’s Calendar web part and app. It enables you to overlay unlimited amount of calendars and views.

As for the events doubling on your color-coded calendar, this may happen when you miss the step of creating a calendar view with a blank category filter. Review Step 3 above.
sharepoint calendars

SharePoint Calendars Color Coding with Calculated Column

This method utilizing a calculated column also works for color-coding SharePoint list of any type. Let us see how it works in adding colors to a SharePoint calendars.

    1. We need to create a new category column for event categories in a SharePoint calendar. Let’s name it as “Event type”. You may pick any other column name you like.
    2. Next, create another column of a Calculated type and insert the following formula into the provided box:

      “|||” & [Event type] & “|||” & [Title]

sharepoint calendars

    1. Create a new view or modify the default view of the SharePoint calendar and replace the name of the month, week, and day views with the name of the created column – “Event type”. This feature is also available for group sharepoint calendars.

sharepoint calendars

  1. Now, insert the following script into the content editor. Choose Click here to add new content, then Edit Source, paste in the script and click Save.

<style>
    .ms-acal-item{
        display:none;
    }
 </style>
 <script src=”https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.js” type=”text/javascript”>
</script>
 <script type=”text/javascript”>
 var shouldcolortext = true;
LoadSodByKey(“SP.UI.ApplicationPages.Calendar.js”, function () {
    window.setTimeout(ColorCodeCalendar, 1000);
});
var sep = “|||”;
function ColorCodeCalendar() {
    var bodyContainer = jQuery(‘#s4-bodyContainer’);
    var q = ‘a:contains(‘ + sep + ‘)’;
    if (bodyContainer.find(q).length > 0) {
        bodyContainer.find(q).each(function (i) {
            var div = jQuery(this).parents(‘div[title]’);
            var colors = GetColorCodeFromCategory(GetCategory(this.innerHTML));
            var anchor = jQuery(this);
            anchor.text(GetText(anchor.text()))
            div.attr(“title”, GetText(box.attr(“title”)));
            div.css(‘background-color’, colors[0]);
            div.css(‘display’, ‘block’);
            if (shouldcolortext) {
                div.find(‘div, a’).css(“cssText”, “color: ” + colors[1] + ” !important;”);
            }
        });
    }
    window.setTimeout(ColorCodeCalendar, 2000);
}
function GetText(originalText) {
    var parts = originalText.split(SEPARATOR);
    return parts[0] + parts[2];
}
function GetCategory(originalText) {
    var parts = originalText.split(SEPARATOR);
    return parts[1];
}
function GetColorCodeFromCategory(category) {
    var bg = null;
    var fg = null;
    switch (category.trim()) {
        case ‘Meetings’:
            bg = ‘#ECD078’;
            fg = ‘#000000’;
            break;
        case ‘Work hours’:
            bg = ‘#D95B43’;
            fg = ‘#000000’;
            break;
        case ‘Birthday’:
            bg = ‘#C02942’;
            fg = ‘#000000’;
            break;
    }
    return [bg, fg];
}

Color Coding Office 365 Calendar with Virto App

The Virto Calendar extends the native SharePoint calendars functions with the ability to overlay more than 10 calendars in one view, and lets users easily adjust calendar categories colors.

View the video guide on how to color code an O365 calendar.

  1. If you have already color coded your calendar, you will see a dropdown color legend on the Calendar upper right part. These colors are for the ones you have on your calendar. Now let’s suppose we do not have a color legend for another calendar, and we want to have one.
  2. We will go to the settings and find Available data source to edit. When we scroll down on our data source settings, we will notice Select field for color coding events. Then we click on it and choose Category. Now we are given a color legend. Here we can designate our own color numbers, or we can choose from the available ones. After choosing it, we scroll down and save it.
  3. Now if we go back to our calendar and click on the eye icon to view, we will see that our data source has a color legend now. So, we can see a lot of different colors on the screen, and now we are able to change the color legend inside of the data source settings. However, there is also an easier way to do that.
  4. If we go to a particular event and click on Edit, we will see an option Change category. If we change the category and save it, we will see that the color of that specific event has changed.

✓ USEFUL LINKS ON SHAREPOINT CALENDARS

Share