cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BoruzsRobin
New Member

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
Super User
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
New Member

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 ! 

View solution in original post

BoruzsRobin
New Member

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
New Member

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,725)