web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery background col...
Power Apps
Answered

Gallery background colour change

(0) ShareShare
ReportReport
Posted on by 394 Super User 2024 Season 1

Dear All,

 

I have a SharePoint list with a choice field status in a gallery in power apps. It has the following choice entries which I want to change the colour background status in a gallery. How is best to do this?

 

Kind Regards

 

Daniel

 

Details: 

Pending = Blue

Send to car park = yellow

Send to lane = yellow

Send to parent (other) = yellow

Dismissed = green

Club/Activity = light green

Absent = grey

Follow up = Light brown

 

Categories:
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @DLCaterhamSch,

     

    Do I understand it correctly that you wish to change the gallery background (for that item) depending on the value of your choice field? This can be achieved by using a Switch() function in the Gallery's TemplateFill property:

    Switch(
     //Change ChoiceFieldName accordingly
     ThisItem.ChoiceFieldName.Value,
     "Pending",
     Color.Blue,
     "Send to car park",
     Color.Yellow,
     "Send to lane",
     Color.Yellow,
     "Send to parent (other)",
     Color.Yellow,
     //Continue with other values & colors
    )

    The string value should match the choice value exactly - pay close attention to e.g. capitalization.

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • DLCaterhamSch Profile Picture
    394 Super User 2024 Season 1 on at

    Unfortunately this doesnt seem to work. So I would like to change the background colour of the choice field "Status" choice in the gallery. I have put the above into the Gallery.

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @DLCaterhamSch,

     

    Would it be possible to provide a screenshot and additional information on what you would like to achieve?

     

    Thanks! 😊

  • DLCaterhamSch Profile Picture
    394 Super User 2024 Season 1 on at

    Here is the picture. So when the status is changed to pending for example it will change the writing on the gallery to a colour.

    Gallery.png
  • LaurensM Profile Picture
    12,516 Moderator on at

    @DLCaterhamSch,

     

    Thanks for the additional info! Could you try my previous Switch statement in the Color property of that label?

    The first parameter of the Switch statement (ThisItem.ChoicFieldName.Value) should be the same value as the label's Text property. Alternatively you could use Self.Text as the first parameter.

     

    Switch(
     Self.Text,
     "Pending",
     Color.Blue,
     "Send to car park",
     Color.Yellow
     //Add additional options below
    )

     

    I hope this helps!

  • DLCaterhamSch Profile Picture
    394 Super User 2024 Season 1 on at

    This seems to change the text, but be good to change the background and leave the text black?

     

    Switch(
     Self.Text,
     "Pending",
     Color.Blue,
     "Send to car park",
     Color.Yellow
     //Add additional options below
    )
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @DLCaterhamSch,

     

    In this case you can leave the Color property as RGBA(0, 0, 0, 1) and use the Switch in the Fill property which will change the background color.

  • DLCaterhamSch Profile Picture
    394 Super User 2024 Season 1 on at

    Dear All,

    I need to get this working now on a grid with a drop down box? I used this code and it doesnt work correctly?

    Kind Regards

    Daniel

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard