Koen Bollen wrote a little script for me to automatically color-code my calendar based on the first character of the event. It is super handy. More people asked me how I do this so this is a short guide how to set it up.

Here’s how you set it up:

  1. Go to https://script.google.com/home
  2. Click ‘New script’
  3. Paste the following script:
function ColorEvents() {

  var today = new Date();
  var nextweek = new Date();
  nextweek.setDate(nextweek.getDate() + 7);
  Logger.log(today + " " + nextweek);

  var calendars = CalendarApp.getAllOwnedCalendars();
  Logger.log("found number of calendars: " + calendars.length);

  for (var i=0; i<calendars.length; i++) {
    var calendar = calendars[i];
    var events = calendar.getEvents(today, nextweek);
    for (var j=0; j<events.length; j++) {
      var e = events[j];
      var title = e.getTitle();
      if (title[0] == "[") {
      if (title[0] == "!") {
      if (title[0] == '#') {
  1. Save the project and give it a nice name
  2. Click the ‘Play’ button to execute the script. A dialog will open to ask for additional permissions. Allow access to your calendar.
  3. Click the button with an icon of a pin with a clock in it (Triggers)
  4. Click ‘Add trigger’
  5. Select ‘ColorEvents’ in the list of functions to trigger
  6. Change the type to ‘Minutes’ and have the trigger run every 15 minutes. Save the trigger.

This script now automatically colors events that start with a [ cyan, with a ! red and # green. Adjusting the character and/or colors in the script should not be too difficult.