twinssbc / Ionic2-Calendar

A calendar component based on Ionic framework
https://ionic-calendar-demo.stackblitz.io
MIT License
387 stars 197 forks source link

How to change the event background color? #664

Closed seatechdev closed 11 months ago

seatechdev commented 11 months ago

I went through the Readme and the Issues but couldn't find the answer - thus posting. I need to change the background color of my events e.g. 6pm - 8pm Test Event in both the weekly and daily view. Right now they are defaulting to my tertiary color. I even tried changing the tertiary color but that didn't help. I would like to set the background color of these events same as the monthly view dates. How do i set a color for both? Looking through the Readme - there is no CSS for it. Please see the CSS section of your readme file.

The customized styles should be added in global.scss. Just adding in each components css file may not work due to the View Encapsulation.

monthview-primary-with-event The date that is in current month and having events

monthview-secondary-with-event The date that is in previous/next month and having events

monthview-selected The selected date

monthview-current The current date

monthview-disabled The disabled date

weekview-with-event The date having all day events, applied to the day header in week view

weekview-current The current date, applied to the day header in week view

weekview-selected The selected date, applied to the day header in week view

weekview-allday-label Applied to the all day label in week view

dayview-allday-label Applied to the all day label in day view

calendar-hour-column Applied to the hour column in both weekview and day view

Monthly View Screenshot 2023-10-16 at 9 21 08 PM

Day View Screenshot 2023-10-16 at 9 21 34 PM

Week View Screenshot 2023-10-16 at 9 20 49 PM

seatechdev commented 11 months ago

After more digging around - calendar-event-inner solved it. Is it possible to add this to the CSS section as well please?

.calendar-event-inner {
   background-color:  var(--ion-color-primary) !important;
   color: white;
}