cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BoruzsRobin
Regular Visitor

Coloring my calendar events

Good day everybody!

I made a calendar from scratch. I'm using nested gallerys to make it work. It works properly, but people would like me to make it when they adding events to a calendar , every events should have its on color. I attached an image. I would like to make it so these "Tests" appear with different colors. And some as other events.

BoruzsRobin_0-1625644763028.png

 

If you need any additional information to be able to help please let me know.

 

Best regards,

Robin

 

1 ACCEPTED SOLUTION

Accepted Solutions

@BoruzsRobin ,

I use a formula based on the last three char of the meeting name. But you have to set a local collection before that. 

In OnStart() property of the app use:

 

ForAll(
     Sequence(26),
     Collect(alphabetCode,
             {ID:Value*2,Char:Char(Value+64)},
             {ID:Value*2+1,Char:Char(Value+96)}
     )
)

 

 and in your Fill property of the label to:

 

RGBA(
   Round(LookUp(alphabetCode,Right(Self.Text,1)=Char,ID)*4,0),
   Round(LookUp(alphabetCode,Mid(Self.Text,Len(Self.Text)-1,1)=Char,ID)*4,0),
   Round(LookUp(alphabetCode,Mid(Self.Text,Len(Self.Text)-2,1)=Char,ID)*4,0), 
   1
)

 

It's just a silly thought 😊 !

 

Hope it helps ! 

View solution in original post

7 REPLIES 7
gabibalaban
Dual Super User
Dual Super User

@BoruzsRobin ,

Using Rand() and Round() functions it can be a way to achive your expectations.

In Fill property of the Label control use something like:

RGBA(Round(Rand()*255,0), Round(Rand()*255,0),Round(Rand()*255,0),1)

In this way all events in calendar will have a randomize color. 

 

Hope it helps ! 

BoruzsRobin
Regular Visitor

Hey, its close, I just have an other problem with it this way.

I would like to give one event the same color, so both of test 1 should be blue.

And for some reason it does not fill out the whole area. //Edit: I worked this out, only need something for the other problem

BoruzsRobin_0-1625731517568.png

 

@BoruzsRobin ,

I use a formula based on the last three char of the meeting name. But you have to set a local collection before that. 

In OnStart() property of the app use:

 

ForAll(
     Sequence(26),
     Collect(alphabetCode,
             {ID:Value*2,Char:Char(Value+64)},
             {ID:Value*2+1,Char:Char(Value+96)}
     )
)

 

 and in your Fill property of the label to:

 

RGBA(
   Round(LookUp(alphabetCode,Right(Self.Text,1)=Char,ID)*4,0),
   Round(LookUp(alphabetCode,Mid(Self.Text,Len(Self.Text)-1,1)=Char,ID)*4,0),
   Round(LookUp(alphabetCode,Mid(Self.Text,Len(Self.Text)-2,1)=Char,ID)*4,0), 
   1
)

 

It's just a silly thought 😊 !

 

Hope it helps ! 

BoruzsRobin
Regular Visitor

Yes its almost OK now! 
How would you change this code so it takes the first three latter not the last three?
Because its seems its working just all of my title last 3 alphabet are the same, so if I could use the first three that would be very good.

@BoruzsRobin ,

RGBA(
   Round(LookUp(alphabetCode,Left(Self.Text,1)=Char,ID)*4,0),
   Round(LookUp(alphabetCode,Mid(Self.Text,2,1)=Char,ID)*4,0),
   Round(LookUp(alphabetCode,Mid(Self.Text,3,1)=Char,ID)*4,0), 
   1
)

 

I prefer the last 3 char because the probability to be different is higher than the first 3 char ( in your example meeeting Test1 and meeting Test2 will have the same color if you use the first 3 char). 

I can try different approach on this matter.

 

BoruzsRobin
Regular Visitor

Yes you are right but that was just for testing purposes. 
Other than that in the title I'm using 7 different names which are different from each other so now its working properly.

Thank you for helping , I appreciate it very much!

I have used your formula, but all entries in  the title Is black. Any idea? 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,146)