From 8053256203f9f59b2d686cba0c8f9146add6f933 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Fri, 27 Apr 2018 11:06:45 -0500 Subject: [PATCH] Added option to calendar module that colors only the symbol instead of the whole line --- CHANGELOG.md | 1 + modules/default/calendar/README.md | 2 ++ modules/default/calendar/calendar.js | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b44bb77..550e118a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Enabled translation of feelsLike for module currentweather - Added support for on-going calendar events +- Added option to calendar module that colors only the symbol instead of the whole line ### Changed - Use Electron 2 Beta. **Please test!** diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index 8605dc3a..65c4741e 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -53,11 +53,13 @@ The following properties can be configured: The `calendars` property contains an array of the configured calendars. The `colored` property gives the option for an individual color for each calendar. +The `coloredSymbolOnly` property will apply color to the symbol only, not the whole line. This is only applicable when `colored` is also enabled. #### Default value: ````javascript config: { colored: false, + coloredSymbolOnly: false, calendars: [ { url: 'http://www.calendarlabs.com/templates/ical/US-Holidays.ics', diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 32b65b37..2e5d4515 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -31,6 +31,7 @@ Module.register("calendar", { hidePrivate: false, hideOngoing: false, colored: false, + coloredSymbolOnly: false, calendars: [ { symbol: "calendar", @@ -135,7 +136,7 @@ Module.register("calendar", { var event = events[e]; var eventWrapper = document.createElement("tr"); - if (this.config.colored) { + if (this.config.colored && !this.config.coloredSymbolOnly) { eventWrapper.style.cssText = "color:" + this.colorForUrl(event.url); } @@ -143,6 +144,11 @@ Module.register("calendar", { if (this.config.displaySymbol) { var symbolWrapper = document.createElement("td"); + + if (this.config.colored && this.config.coloredSymbolOnly) { + symbolWrapper.style.cssText = "color:" + this.colorForUrl(event.ulr); + } + symbolWrapper.className = "symbol align-right"; var symbols = this.symbolsForUrl(event.url); if(typeof symbols === "string") {