To change Event Color just simply supply color option in event object
<FullCalendar
timeZone="Asia/Tokyo"
plugins={[dayGridPlugin, interactionPlugin]}
initialView="dayGridMonth"
headerToolbar={{
start: "prev",
center: "title",
right: "next",
}}
height="100%"
locale="ja"
aspectRatio={0.7}
dateClick={(dateArg: DateClickArg) => {
this.props.dateSelect(dateArg.date);
}}
longPressDelay={1}
dayCellContent={function (arg: DayCellContentArg) {
return arg.date.getDate().toString();
}}
events={[
{
title: "??",
allDay: true,
start: this.getSelectedDate(),
end: this.getSelectedDate(),
color: "red",
},
]}
editable={false}
selectable={true}
/>
example event object below
events={[
{
title: "??",
allDay: true,
start: this.getSelectedDate(),
end: this.getSelectedDate(),
color: "red",//This will set the color
}
]}
this will change background color of event you don't ned special CSS or anything
Still if you programmatically want to change the background color of event then bind a event handler on each event by using eventDidMount callback, this function will be fired after appending each event element so you can simply change event css or element programmatically.
<FullCalendar
eventDidMount={(dateArg: DateClickArg) => {
console.log(dateArg.el); //this will return event element
}},
events={[
{
title: "??",
allDay: true,
start: this.getSelectedDate(),
end: this.getSelectedDate(),
color: "red",
},
]}
/>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…