Added option to calendar module that colors only the symbol instead of the whole line

This commit is contained in:
Brian Johnson 2018-04-27 11:06:45 -05:00
parent 05ef68e079
commit 8053256203
3 changed files with 10 additions and 1 deletions

View File

@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Enabled translation of feelsLike for module currentweather - Enabled translation of feelsLike for module currentweather
- Added support for on-going calendar events - Added support for on-going calendar events
- Added option to calendar module that colors only the symbol instead of the whole line
### Changed ### Changed
- Use Electron 2 Beta. **Please test!** - Use Electron 2 Beta. **Please test!**

View File

@ -53,11 +53,13 @@ The following properties can be configured:
The `calendars` property contains an array of the configured calendars. The `calendars` property contains an array of the configured calendars.
The `colored` property gives the option for an individual color for each calendar. 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: #### Default value:
````javascript ````javascript
config: { config: {
colored: false, colored: false,
coloredSymbolOnly: false,
calendars: [ calendars: [
{ {
url: 'http://www.calendarlabs.com/templates/ical/US-Holidays.ics', url: 'http://www.calendarlabs.com/templates/ical/US-Holidays.ics',

View File

@ -31,6 +31,7 @@ Module.register("calendar", {
hidePrivate: false, hidePrivate: false,
hideOngoing: false, hideOngoing: false,
colored: false, colored: false,
coloredSymbolOnly: false,
calendars: [ calendars: [
{ {
symbol: "calendar", symbol: "calendar",
@ -135,7 +136,7 @@ Module.register("calendar", {
var event = events[e]; var event = events[e];
var eventWrapper = document.createElement("tr"); var eventWrapper = document.createElement("tr");
if (this.config.colored) { if (this.config.colored && !this.config.coloredSymbolOnly) {
eventWrapper.style.cssText = "color:" + this.colorForUrl(event.url); eventWrapper.style.cssText = "color:" + this.colorForUrl(event.url);
} }
@ -143,6 +144,11 @@ Module.register("calendar", {
if (this.config.displaySymbol) { if (this.config.displaySymbol) {
var symbolWrapper = document.createElement("td"); 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"; symbolWrapper.className = "symbol align-right";
var symbols = this.symbolsForUrl(event.url); var symbols = this.symbolsForUrl(event.url);
if(typeof symbols === "string") { if(typeof symbols === "string") {