cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Skilled Sharer
Skilled Sharer

Setting app colors in OnStart

The Set-Up

In attempting to create a standard color palette based on out branding colors, I attempted to set these color values to variables in OnStart, so as to have easy access to them throughout the application.

 

App->OnStart, I added this code:

 

Set(_LightestYellow, ColorValue("#ffce6e"));

 

BenDonahue_0-1619012217697.png

After running OnStart, I then tried to use this in a Fill for a label, like so:

BenDonahue_1-1619012293111.png

Which filled my label with black, thusly:

BenDonahue_2-1619012341728.png

Checking my variables, I see that _LightestYellow is defined as a color, but has no value:

BenDonahue_3-1619012405671.png

Setting the Fill value for the label to the what the variable was supposed to be defined as ,

 

ColorValue("#ffce6e")

 

, fills the label with yellow:

BenDonahue_4-1619012679717.png

The Goal

I would like to have a standard block of code that I add to every app so that I can access the branding colors easily

 

The Question

What (probably super simple) thing am I missing that is preventing me from successfully defining a variable as a ColorValue()?

 

1 ACCEPTED SOLUTION

Accepted Solutions
KrishnaV
Community Champion
Community Champion

@BenDonahue ,


Try this,
on OnStart give only the HEX value as

Set(_LightestYellow, "#ffce6e");

 on the label fill property you say as:

ColorValue(_LightestYellow)

 This will work

 



I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a THUMS-UP and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

4 REPLIES 4
KrishnaV
Community Champion
Community Champion

@BenDonahue ,


Try this,
on OnStart give only the HEX value as

Set(_LightestYellow, "#ffce6e");

 on the label fill property you say as:

ColorValue(_LightestYellow)

 This will work

 



I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a THUMS-UP and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

BenDonahue
Skilled Sharer
Skilled Sharer

@KrishnaV ,

Yup, that did it. Thank you for you assistance, Krishna.

-Ben

great and happy to know. Remember when you assign the Color("djdjdj") to a variable on OnStart and then you try to use for Fill .. the variable behaves like a boolean variable and it return true or false 🙂

 



I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a THUMS-UP and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

BenDonahue
Skilled Sharer
Skilled Sharer

Would you go into a bit more detail on that, please?
Are you talking about this kind of code put into OnStart:
Set(_LightestBlue, ColorValue("#08c5fb"));   ?


Under what condition would it return true and under what condition would it return false?

I tried plugging

_LightestBlue

into the text field, and the error came that it was expecting a text value. Also, in the variables, it sad that _LightestBlue has no value.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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