Skip to content

Repository files navigation

MMM-CalendarLegend

A MagicMirror² module that displays a clean legend/key for your configured calendar feeds, showing each calendar's name and color.

This module listens for CALENDAR_EVENTS notifications from the default calendar module and dynamically builds a legend based on active calendars.


✨ Features

  • Automatically detects calendars from incoming events
  • Displays color-coded legend
  • Lightweight (no helper required)
  • Optional sorting and counts
  • Customizable styling

📷 Screenshot

screenshot


📦 Installation

cd ~/MagicMirror/modules
git clone https://github.com/ex247/MMM-CalendarLegend.git

⚙️ Configuration

Add this to your config.js:

{
  module: "calendar",
  position: "top_left",
  config: {
    calendars: [
      {
        url: "ICAL_URL_1",
        name: "Work",
        color: "#ff0000"
      },
      {
        url: "ICAL_URL_2",
        name: "Family",
        color: "#00ff00"
      }
    ]
  }
},
{
  module: "MMM-CalendarLegend",
  position: "top_right",
  config: {
    showCounts: false,
    sort: "name",
    defaultColor: "#999",
    updateDelay: 0
  }
},

🔧 Configuration Options

Option Description Default
showCounts Show number of events per calendar false
sort Sorting method: name or none name
defaultColor Fallback color if none is defined #999
updateDelay Delay before DOM update (ms) 0
calendars Static calendar definitions (fallback/manual mode) []
autoSync Automatically read calendars from calendar module true

calendars format

calendars: [
  { name: "Work", color: "#ff0000" },
  { name: "Family", color: "#00ff00" }
],

These will be displayed even if there are no active events.


Update

Navigate into the MMM-CalendarLegend folder with cd ~/MagicMirror/modules/MMM-CalendarLegend and get the latest code from Github with git pull.

If you haven't changed the modules, this should work without any problems. Type git status to see your changes, if there are any, you can reset them with git reset --hard. After that, git pull should be possible.


🧠 How It Works

  • Listens for CALENDAR_EVENTS
  • Extracts calendarName and color
  • Optionally auto-syncs with the calendar module config
  • Builds a unique list of calendars
  • Updates DOM when new data arrives

🔄 Auto-Sync Mode

When autoSync: true, the module will read calendar definitions directly from the loaded calendar module at runtime.

No need to duplicate your calendar list in this module.



📁 File Structure

MMM-CalendarLegend/
├── MMM-CalendarLegend.js
├── MMM-CalendarLegend.css
└── README.md

🚀 Future Ideas

  • Persist calendar list even with no events
  • Click-to-toggle calendars
  • Match calendar module fade/opacity styles

📜 License

MIT


🙌 Contributing

Pull requests welcome!


⭐ Credits

Built for the MagicMirror² community

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages