spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Add custom style for each calendar event

Open davide-pi opened this issue 2 years ago • 5 comments

Description

Implemented the custom highlight style for single calendar event. Also requested with issue #1234.

Example

As shown below the calendar now support the default highlight style 2023-06-22 but also support different style for different events like 2023-06-24 and 2023-06-25 in yellow foreground and 2023-06-27 with red foreground

image

To Test

To test this implementation is sufficient to put it into the Main method of the Program.cs in the Spectre.Console.Analyzer.Sandbox .

        var today = DateTime.Today;

        var calendar = new Calendar(today.Year, today.Month);

        //Just keep an eye on the current day
        calendar.AddCalendarEvent(today);

        //Interesting events
        calendar.AddCalendarEvent(today.AddDays(2), Color.Yellow);
        calendar.AddCalendarEvent(today.AddDays(3), Color.Yellow);

        //Inderogable important event
        calendar.AddCalendarEvent(today.AddDays(5), Color.Red);

        AnsiConsole.Write(calendar);

davide-pi avatar Jun 22 '23 10:06 davide-pi

Hi @patriksvensson, I'm sorry, but I'm new to GitHub contributions. I've noticed that no reviewers are automatically added to my PRs, and I haven't found a way to add myself either. I just wanted to notify you about my following 3 PRs:

  • #1246 (this one)
  • #1245
  • #1244

I apologize if this is not the correct way, or if you have already been notified about these 3 PRs and you will be checking them in the future.

I just wanted to make sure to bring them to your attention. Thank you.

davide-pi avatar Jun 23 '23 14:06 davide-pi

@davide-pi Hello, yes we do not automatically assign reviewers to PRs. We do things as we have time. Right now we’re all on summer vacation so work on this project will be at a minimum. We work on this project in our spare time and we all have jobs and families so there isn’t really an SLA.

Someone will get around to reviewing this at some point. I will try to set aside some time next week.

patriksvensson avatar Jun 25 '23 07:06 patriksvensson

Thanks for explaining. I will wait for a review when someone of you has time. Thanks again.

davide-pi avatar Jun 25 '23 11:06 davide-pi

I haven't seen this pull request and therefore created https://github.com/spectreconsole/spectre.console/pull/1254... :D

The benefit of this here is that there's still the option to specify a default highlight color for the whole calendar while mine doesn't allow that (In my case that was ok, as I don't need the option either way).

SeppPenner avatar Jul 10 '23 14:07 SeppPenner

This one would be really nice and I guess is neither breaking nor difficult to verify that it works...

SeppPenner avatar Jan 05 '24 09:01 SeppPenner

@patriksvensson Can we get this into the next release, please? (At the moment, I maintain a custom fork of the project to use the feature...) 😅

SeppPenner avatar Feb 27 '24 07:02 SeppPenner