0

I need some help with color coding a calendar.

Currently, I have this calendar: enter image description here

It's color-coded and everything, and is exactly what I want. The issue is that when I click on one of the 'Calendars in View'. If I click on 'equip 5' for example, I get this: enter image description here

This would be perfectly fine, but I'd really like to have the color stay consistent. Instead of it defaulting to orange, is there a way I can make it magenta, like it is in the global calendar? I've tried doing the same steps to the equip 5 calendar that I did to the global one, however since I'm using the equip 5 calendar, I can't 'add' the equip 5 calendar again to the 'Calendars in View'. Can anyone help?

I'm using SharePoint 2013.

3

The problem is that SharePoint isn't coloring items based on the identity of the particular views (i.e. "Equip 1" is always pink, "Equip 2" is always magenta), instead, it colors items based on numbering, i.e. the first calendar in the view will always be orange, the second will always be pink, etc. (Or whatever you have set up in the overlays.)

So, when you click on one of the "calendars in view" and go to a new view that has only that calendar in it, it all of a sudden has become the "first" calendar, and so gets the "first calendar" color.

The calendar colors are based on CSS classes:

ms-acal-item    /* the default/first color */
ms-acal-color1  /* even though it has the number 1 in it, it's actually color #2 */
ms-acal-color2  /* really the third */

etc.

So, what you would want to do is go to the individual calendar you want to make consistent with the global calendar, and override the default CSS and tell it to use the color you want.

In order to do that, go to the calendar page (i.e. "Equip 5", not the global calendar), edit the page, add a Script Editor Web Part at the top of the page, and embed the following as the script snippet:

<style type="text/css">
.ms-acal-item {
    background-color: magenta;  /* or whatever color you want it to be */
}
</style>

PS - the reason you weren't able to get the solution from the answer you linked to to work is that that answer is a bit misleading. The line of code there is jQuery, and people who have worked with jQuery in SharePoint will know that there is a bunch of other lines of code you need in addition to that one line to get everything to work. The code I have shown above is complete and is all you should need when adding it to a Script Editor web part.

  • Thank you! And thanks for going so in-depth on your answer! – Luke K Aug 3 '16 at 16:16
0

You can refer below URL to change color for Calendar Overlay:

SPO Calendar overlay background color and text color change

every color in Calendar overlay is considered as 1,2,3....9. Find the number of the color you have selected in calendar overlay and update the script in the URL to reflect the number to change your color selection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.