Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
1 like 0 dislike
7.9k views
in Power Apps by 3 3 3

How can I change text color based on a condition in powerapps?

For example, if I have a label control that displays some calculation on it, I want to change the color depending on a condition say 

  • If the label equal to 5 shows the label color as red.
  • If the value is greater than 5, it should display green color?

1 Answer

0 like 0 dislike
by 48 54 93
edited by

Multiple conditional statements to change the color of the control

Try to use this formula to change the text color of control based on a specific condition in power apps

If(Value(Label.Text)=5,Red,Value(Label.Text)>5, Green)

Note: In the above formula, you can add more conditions as you prefer

by 1
0 0
hi how can i apply this but based on days passed.
1 days old =GREEN
2 days old= yellow
3days=orange
4 days=red.

i tried using this formula in the color cell for font but it only changes it to red. I must have something wrong. Please help. If(ThisItem.'ARRIVAL DATE.'<=Today()+1,RGBA(249,31,38,1),ThisItem.'ARRIVAL DATE.'>=Today()-2,RGBA(44,210,47,1),ThisItem.'ARRIVAL DATE.'<=Today()-3&&ThisItem.'ARRIVAL DATE.'>=Today()-4,RGBA(232,225,27,1),ThisItem.'ARRIVAL DATE.'>Today()-5,RGBA(249,132,31,1))
If you don’t ask, the answer is always NO!
...