Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

IF Function - different colors of a button

(0) ShareShare
ReportReport
Posted on by 390
Hi at all,
 
I want to give my button different colors.
 
If(ThisItem.IsSelected;RGBA(116; 177; 102; 1);
If(ThisItem.Result = "Keine Anforderung";ROT.Fill;Doppio.Fill))
Thanks for your help
  • Robertjde Profile Picture
    390 on at
    IF Function - different colors of a button
     
    I wanted to use the IF function to ensure that when the button is pressed in a particular gallery, the selection becomes permanent visible.
     
    Unfortunately, due to the request for the last gallery, another condition was added, which means the IF code no longer works.
    Your idea therefore does not lead to a solution.
     
     
     
     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    45,136 Super User 2025 Season 2 on at
    IF Function - different colors of a button
     
    You want to use the following
     
    PressedFill <== fill its with your green color
    PressedBorderColor <== to set the color of the border when pressed
    PressedColor <== changes the font color so you can see it. as the befault is white and wont show up well.
     
    In my case i changed the border and fill to your color, but I did NOT change the font color hence you cannot read it :-) I s hould have changed it to black or something else
     
    Thats the issue.
     
    don't use IsSelected,
    Use the Pressed Properties
     
    You do not even need an IF statement in them, just put your Color choice like this
     
    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.
    Thank you!
    Sincerely, Michael Gernaey
  • Robertjde Profile Picture
    390 on at
    IF Function - different colors of a button
     
    This currently works
     
    If(ThisItem.Result = "Keine Anforderung";Rot.Fill; Doppio.Fill)
     
     
    When I select a button, it should turn green and this doesn't work with my code:
     
    If(ThisItem.IsSelected;RGBA(116; 177; 102; 1);
       If(ThisItem.Result = "Keine Anforderung";ROT.Fill;Doppio.Fill)
    )
     
  • Robertjde Profile Picture
    390 on at
    IF Function - different colors of a button
    Yes, it's a classic button in a gallery.
    Rot (RED) and Doppio (BROWN) are colors, and at my location I have to use ; instead of commas.
  • Michael E. Gernaey Profile Picture
    45,136 Super User 2025 Season 2 on at
    IF Function - different colors of a button
     
    So you appear to have a gallery, is a guess because you have IsSelected which is not part of a button. So you want to have it a certain color if the row is selected, and another based on .Result if its NOT selected?
     
    Is this the Classic or Modern Button? What is ROFT.Fill and Doppio.Fill are those other controls?
     
    Your code looks fine, I am assuming you are in a locatlization that uses ; instead of commas ,
    If(ThisItem.IsSelected;RGBA(116; 177; 102; 1);
       If(ThisItem.Result = "Keine Anforderung";ROT.Fill;Doppio.Fill)
    )
     
    So what is the problem exactly? Did you put this in the Fill property of your button.
     
    can you please provide more details as what I am looking at, assuming ROT and Doppio are controls and have Fill properties, should work just fine and if its in a gallery  than your IsSelected check should work fine.
     
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2