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

Community site session details

Session Id : /eIW++dohOGmjSk3e2rId1
Power Apps - Building Power Apps
Answered

Differente color dropdown DataCardValue (List Sharepoint)

Like (0) ShareShare
ReportReport
Posted on 18 Jun 2021 09:47:51 by 28

Hello everyone, 

 

I'm writing to you because I'm stuck on a manipulation that I think is actually simple to perform.
I created a list on sharepoint that I put on powerapps as Forms. In this list is a drop-down menu in which I have the values "TB", "B", "M", "I", "TI" (which means very good, good, average, insufficient, really insufficient, in French).

 

My goal is to display these values with different colors in the dropdown menu ("TB" in green for example and "TI" in red).

 

I already managed to display the final value with its color in SelectedTagFill with this code (you can find the result in attachment Screenshot 1):

If(

  DataCardValue25.Selected.Value = "TB", Color.MediumSeaGreen,

  DataCardValue25.Selected.Value = "B", Color.DarkTurquoise,

      DataCardValue25.Selected.Value = "M", Color.Gray,

      DataCardValue25.Selected.Value = "I", Color.Gold,

      DataCardValue25.Selected.Value = "TI", Color.Tomato

      )

 

The color is also correct in the SelectionFill (screenshot 2). 

But all the boxes are white and I can't assign the right color to them, I would like each choice to have a different color when I unroll the menu.

I have the same problem with my HoverFill (I put the same code than for my SelectedTagFill) which when I move my mouse over the values has the color of the selected value and not a different color each time (Screenshot 3).

 

I tried with "DataCardValue25.Value" instead of "DataCardValue25.Selected.Value" but I have an error. 

 

Please to you have a tips for me ? 

 

(I tried to make 

If(
DataCardValue25.Selected.Value = "TB", Color.MediumSeaGreen,If(
DataCardValue25.Selected.Value = "B", Color.DarkTurquoise, If(
DataCardValue25.Selected.Value = "M", Color.Gray, If(
DataCardValue25.Selected.Value = "I", Color.Gold, If(
DataCardValue25.Selected.Value = "TI", Color.Tomato
)))))

But I have the same result).

Categories:
I have the same question (0)
  • Marie_Causse Profile Picture
    28 on 21 Jun 2021 at 14:11:53
    Re: Differente color dropdown DataCardValue (List Sharepoint)

    Ok, thank you for your help. Have a good day !

  • Verified answer
    WarrenBelz Profile Picture
    150,345 Most Valuable Professional on 21 Jun 2021 at 09:48:54
    Re: Differente color dropdown DataCardValue (List Sharepoint)

    Hi @Marie_Causse ,

    Yes that is correct - there is no way of having different colours in each item of a drop-down.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • proxyprochy Profile Picture
    92 on 21 Jun 2021 at 09:47:52
    Re: Differente color dropdown DataCardValue (List Sharepoint)

    Looks like it doesn't change the color when the selection is changed. The solution could be:

     

    DataCardValue25.HoverFill = selectedTextColor

     

    DataCardValue25.OnChange =
    Switch(
    Self.Selected.Value,
    "TB",
    UpdateContext({selectedTextColor: Red}),
    "B",
    UpdateContext({selectedTextColor: Blue})
    )

  • Marie_Causse Profile Picture
    28 on 21 Jun 2021 at 08:53:26
    Re: Differente color dropdown DataCardValue (List Sharepoint)

    Thank you, your way to write it is so much cleaner et easier, I am going to use it ! But this does not change the result...

    I always have the color that corresponds to the color of the selected text and not a different color or one that changes depending on the text.

  • WarrenBelz Profile Picture
    150,345 Most Valuable Professional on 18 Jun 2021 at 22:33:04
    Re: Differente color dropdown DataCardValue (List Sharepoint)

    Hi @Marie_Causse ,
    Use this

    Switch(
     Self.Selected.Value,
     "TB", Color.MediumSeaGreen,
     "B", Color.DarkTurquoise,
     "M", Color.Gray,
     "I", Color.Gold,
     "TI", Color.Tomato
    )

    on the SelectionFill and then the Color is simply

    Self.SelectionFill

    Your HoverFill will be dependant on what is selected (it does not know what it is hovering over), but you can use the same syntax on it.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 982 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 396 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 356

Last 30 days Overall leaderboard