mattlewis92 / angular-calendar

A flexible calendar component for angular 15.0+ that can display events on a month, week or day view.
https://mattlewis92.github.io/angular-calendar/
MIT License
2.72k stars 866 forks source link

How to customize event action text color: 'Edit' and 'Delete' within an event in the day/week view #1692

Open sebastianrychlik opened 11 months ago

sebastianrychlik commented 11 months ago

Describe the bug

I have been trying to customize the color of the event action text (':Edit Delete') within an event in the day view of the calendar. Is there any way to customize the color of the event action text within an event? Currenty, the text is white, so it is hardly visible.

Minimal reproduction of the problem with instructions

Screenshots

Versions

matts-bot[bot] commented 11 months ago

Thanks so much for opening an issue! If you'd like to support this project, then please consider sponsoring me

sebastianrychlik commented 11 months ago

The solution: declare actions array, e.g.:

  actions: CalendarEventAction[] = [
    {
      label: '<span class="text-primary link m-l-5">: Edit</span>',
      onClick: ({ event }: { event: CalendarEvent }): void => {
        this.handleEvent('Edit', event);
      },
    },
    {
      label: '<span class="text-primary m-l-5">Delete</span>',
      onClick: ({ event }: { event: CalendarEvent }): void => {
        this.events = this.events.filter((iEvent) => iEvent !== event);
        this.handleEvent('Deleted', event);
      },
    },
  ];

then declare the event with this.actions assigned to actiions properity:


  events: CalendarEvent[] = [
    {
      start: subDays(startOfDay(new Date()), 1),
      end: addDays(new Date(), 1),
      title: 'A 3 day event',
      color: colors.red,
      actions: this.actions,
    }]