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 / Button with 6 differen...
Power Apps
Answered

Button with 6 different colors

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone,

I have a button on my app and i want it to change between 6 colors.

Eksample:

 

1. Click = Green 

2. Click = Yellow

3. Click = Blue 

4. Click = Orange

5. Click = Purple

6. Click = Red 

And it should make a record on my sharepoint list. Is that possible ? 

 

Thank you 

Categories:
I have the same question (0)
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous In the OnStart of the App, do this,

    Set(gblClickCount,0)

    In the OnSelect of the Button, do this.

    Set(gblClickCount,gblClickCount+1)

    In the Fill property of the Button, do this,

    Switch(gblClickCount,

    1, Green,

    2, Yellow,

    3, Blue, 

    4, Orange,

    5, Purple,

    6, Red

    ) 

     

    To record the current state of the button to the SP List, do this,

    Patch(yourSPList, recordtopatch, {columname:gblClickCount})

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @CNT 

    Thanks for your respons dear but its not working the button goes black 

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous "the button goes black" When?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @CNT 

    Not back but Black 

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous It will turn black after 6 clicks. So you'll have to reset the counter,

    In the OnSelect of the Button, do this.

    If(gblClickCount<6,Set(gblClickCount,gblClickCount+1),Set(gblClickCount,1))

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @CNT 

     

    There is something wrong 

    1.png

  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Maybe in your region you need to use a semicolon(;) instead of a comma. Try replacing all the commas in all the formulas with a semicolon.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @CNT 

    The only thing i need is when i close the app and open it the buttons should not go to back to default !!

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous To do that you will have to save the last value in your SP List.

    Patch(yourSPList, First(yourSPList), {columname:gblClickCount})

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Its recording to a sharepoint as well but if i refrsh the page the button goes back to default

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 325 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard