fullcalendar: textColor is not applied to background events
I am using v5-rc1 and background nor text changes color when
eventSources: [
{
url: 'http://localhost/matpro/public/event-feed',
},
{
url: 'http://localhost/matpro/public/holiday-feed',
eventBackgroundColor: 'coral',
eventTextColor: 'black',
display: 'background'
}
]
Everything is working except the colors. I can change the background color with color: 'coral' but have not found a way to change the text, it just stays white, while background stays mint by default.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 3
- Comments: 25 (5 by maintainers)
I’m using a workaround for that using eventDidMount:
Here is a workAround that works… 😉. overwrite fc-bg-event opacity and past your transparency with the color. So textColor will keep is opacity to 1 on background Events.
code: .fc .fc-bg-event { opacity: 1; } … color:
rgba(${r}, ${g}, ${b}, ${opacity}).or if you don’t have acces to the color. You can change it with that function. color: hexToRGBA(item.color, 0.3)
function hexToRGBA(hex, opacity) { // Retire le # si il est présent hex = hex.replace(/^#/, ‘’);
}
@gasparfm i tried to implement what you did but I still don’t see text color changes.
Hey @arshaw as you can see from picture Its difficult to read the texts. Do we have any update on this issue?
NOTE: I have used background events and made background color white. I just need to make text darker so that its more visible
I’ve just run into this, and can conclusively show that the problem is:
is applied BELOW the
<a>wrapper around the event. When you add a color or className to an event OR to an eventSource, this is added to the<a>wrapper:As you can see, I have class “ticket” applied to both the eventSource and the event; I also have the element styles applied (from the eventSource) - but NEVER-THE-LESS
.fc-event-mainTROMPS on the color value.I have a work-around because I’m implementing the eventContent hook (ugly though it may be) - but this is just plain WRONG if your intent is to allow developer control of the colors.
EITHER the event & eventSource classes and styles should be applied to the inner div (
.fc-event.main), OR thatcolor:should be REMOVED.@LiamBull Actually you can control the color via css classes. Declare css class and rules you want to affect event title and then provide it as
classNamesvalue as described in the docsThe issue is that
textColordoes not work for background events so I’ll reopen this.https://codepen.io/acerix/pen/dyGVeee