Jump to content

Recommended Posts

  • 3 years later...
Posted

The lack of control of the event font color is really a pain. In a CalendarPanel with 5 Calendars, it chooses bad colors for the events text, making it really difficult to read. Sometimes, it sets the event font color as the same as the background, making it impossible to read.

Does anyone knows a workaround for this problem?

Posted

Yes you can, here is how to do it:

 

Calendar event color depends on EventID.

 

id1=.ext-color-1

id2=.ext-color-2

id3=.ext-color-3... and so on...

 

So I add js code, for ecample: Form->UniEvents->beforeinit:

function randomColor() {
    var rgb = [];
    for(var i = 0; i < 3; i++) {
     if(i==1) rgb.push(Math.floor(Math.random() * 50));
     else rgb.push(Math.floor(Math.random() * 255));
    } 
     return 'rgb('+ rgb.join(',') + ')';
  }
  
  for(var i=1;i<200;i++) {
   $("<style type='text/css'> .ext-color-"+i.toString()+"{ color:"+randomColor()+";} </style>").appendTo("head");
  }    
  • Upvote 1
  • 1 year later...
Posted

Hi Mohammad,

 

Regarding your example, how do I change the unicalendar  colors of a date cell at runtime, I used you code to create the colors styles but how to make a specific date have one of those colors?

 

Regards

 

Jose

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...