Eric's Calendar : how to choose which of conflicting colors for a day to display?

69 views
Skip to first unread message

Jacques Turbé

unread,
May 15, 2021, 3:31:44 PM5/15/21
to TiddlyWiki

Hello,

I'm adopting Eric's TiddlyTools/Time/Calendar. Thanks to him.

I have a problem when conflicting colors happen for a same day. How to force priority on the color I'd want ?

An instance :
  • I have a timeline for team members absences, coded "OldLace". Fred is not available Monday and Tuesday next.
  • I decide to settle a meeting, even without Fred that monday. Team meeting are "LightGreen" coded events.
  • When I publish the calendar, I want Monday color to be LightGreen for everybody, but it remains OldLace.
What should I do ?

Thanks.

Eric Shulman

unread,
May 15, 2021, 4:53:53 PM5/15/21
to TiddlyWiki
When there are multiple events for a given date, they are sorted by the title of the EventList or Timeline that defines them and the date color is determined by the first event in the resulting list.

Here's the code from the showDay() macro that does the work:
<$wikify name="colors"       text="<$list filter=<<todays_events>>>{{{ [<currentTiddler>split[;]nth[1]get[eventcolor]] }}} </$list>">
<$set    name="eventsbg"   filter="[enlist<colors>first[]addprefix[background:]addsuffix[;]else<eventsbg>]">

If you have a Timeline named "Absences" (using the OldLace color) and an EventList named "Meetings" (using the LightGreen color), then the OldLace color will be applied, since "Absences" comes before "Meetings", alphabetically.

The only way to influence the color that is used is to rename the Timeline or the EventList so that the event color that you want to have priority occurs first in the sorted list of events.  For example, you could rename "Meetings" to "1Meetings" so it comes before "Absences", or rename "Absences" to "ZAbsences" so it comes after "Meetings".

However, renaming a Timeline can be quite a nuisance, because the name of the Timeline is also used to tag each individual tiddler that belongs to that Timeline.  Thus, you would have to change not only the name of the "Absences" Timeline tiddler itself, but also update the corresponding "Absences" tag on every individual tiddler belonging to that Timeline.

Fortunately, renaming an EventList is much easier than renaming a Timeline, since there is only one tiddler involved with no extra tagging issues.  Note that even if you rename the "Meetings" EventList tiddler to "1Meetings", you can also give that tiddler a caption of "Meetings", so that the leading "1" won't appear in the Calendar interface.

When I wrote this part of the Calendar, I had considered adding extra code to address this issue by allowing explicit specification of the color order, but all the implementations I could think of would have added considerable complexity and processing overhead to the Calendar rendering logic.

I hope this explanation isn't too confusing.  Let me know how it goes...

-e

Jacques Turbé

unread,
May 15, 2021, 6:57:38 PM5/15/21
to TiddlyWiki
Thanks for your fast answer, Eric. I think I've understood. I'll try and test tomorrow (middle of night here), and report.

Jacques Turbé

unread,
May 15, 2021, 7:36:23 PM5/15/21
to TiddlyWiki
Couldn't wait. It works. Fantastic !

I renamed an event list and an .ics : LightGreen I was looking for immediately flashed !
My timeline title began with "S', absence  was already a caption, so I left it untouched.

Obviously, tiddler titles have to be designed for the process, and must be kept invariable.
Captions have to be clear for usage and publication, and may evolve with needs.

Thanks, Eric-

Le samedi 15 mai 2021 à 22:53:53 UTC+2, Eric Shulman a écrit :
Reply all
Reply to author
Forward
0 new messages