Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Change the Alpha Value of RGBA derived from a Variable?

Like (0) ShareShare
ReportReport
Posted on 14 Aug 2023 10:38:47 by 309

I have a variable which defines a "colour scheme" from my App, based on Slider Values selected by the User:

Set(varFillColour,RGBA(Slider2.Value,Slider2_1.Value,Slider2_2.Value,(Slider2_6.Value/100)))

 

These Values are stored in a DataVerse Table and read every time the User opens the App. It works for both the Fill and Color Properties of various Objects on a Screen. However, in some instances, I need to change the Alpha Value from within that defining RGBA Variable - but only for the individual Object where it is in use. I am trying to "fade out" some Objects, based on the colour scheme selected by the User.

 

Is there a way to extract or "read" the details of my varFillColour variable - and then to change one Value only (in my case the element which defines the Alpha Value in an RGBA definition) for a single Object - without that change affecting the Global implications of the Variable?

Thanks!

  • Verified answer
    AdamGill1965 Profile Picture
    309 on 23 Aug 2023 at 14:08:31
    Re: Change the Alpha Value of RGBA derived from a Variable?

    I resolved this and created a demo:

    https://www.reddit.com/r/PowerApps/comments/15yl49i/i_made_a_thing_let_me_know_if_you_think_its/

     

    Adam

  • AdamGill1965 Profile Picture
    309 on 14 Aug 2023 at 12:53:45
    Re: Change the Alpha Value of RGBA derived from a Variable?

    I apologize for not explaining fully - the Slider Values are used to initially set the Values for RGBA. The User then PATCHes those Values to their Profile Record, so that the next time the User logs in, it reads their colour preferences from that Record (a Dataverse Table). I am now inclined to believe that I will need to find a different method entirely to achieve what I need - but I really do appreciate your suggestions!

  • AdamGill1965 Profile Picture
    309 on 14 Aug 2023 at 12:48:37
    Re: Change the Alpha Value of RGBA derived from a Variable?

    Thank you however this breaks the formula set for a Value in RGBA(0,0,0,0)

  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on 14 Aug 2023 at 11:04:51
    Re: Change the Alpha Value of RGBA derived from a Variable?

    Hi @AdamGill1965,

     

    A possible workaround could be storing the Red, Green and Blue values as a concatenated string in your table.

     

    //The value to be saved in the new text column
    $"{Slider2.Value};{Slider2_1.Value};{Slider2_2.Value}"

     

    Afterwards, you can easily reference the values by splitting that text column and changing the alpha value. (Let's call that column colorConcat):

     

    With(
     //colorConcat should also have a record reference (LookUp...)
     {wColor: Split(colorConcat,";")},
     RGBA(
     Index(wColor,1).Value,
     Index(wColor,2).Value,
     Index(wColor,3).Value,
     //Change to the correct slider reference
     (Slider2_6.Value/100)
     )
    )

     

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

    Thanks!

  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on 14 Aug 2023 at 11:02:02
    Re: Change the Alpha Value of RGBA derived from a Variable?

    @AdamGill1965 - could you declare the Global Variable with something like this:

     

    Set(
     varFillColor,
     {
     R: Slider2.Value,
     B: Slider2_1.Value,
     G: Slider2_2.Value,
     A: (Slider6.Value/100)
     }
    );

     

    And then update the Alpha value for that specific object only? E.g.:

     

    RGBA(
     varFillColor.R,
     varFillColor.B,
     varFillColor.G,
     0.5 //whatever value you want to apply for the object
    )

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

  • timl Profile Picture
    35,013 Super User 2025 Season 1 on 14 Aug 2023 at 10:58:23
    Re: Change the Alpha Value of RGBA derived from a Variable?

    Hi @AdamGill1965 

    A good start would be to look at this excellent post by @iAm_ManCat. That describes how to extract the alpha value from a colour.

    https://powerusers.microsoft.com/t5/Building-Power-Apps/ColorFade-and-Alpha-value/m-p/2126067

     

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 42 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 41 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 36

Overall leaderboard