Skip to main content

Notifications

Community site session details

Community site session details

Session Id : v1ml9L91072S4V1T3+xXIo
Power Apps - Building Power Apps
Answered

Using String in RGBA format as Color Value

Like (1) ShareShare
ReportReport
Posted on 26 Jun 2024 13:58:12 by 1,272 Super User 2025 Season 1

I have a Collection of color values in "RGBA(####,####,####,#.#)" format. When I use this as a color value:

LookUp('App Style Guide',Name = "App Bar Fill").RGBA

 

which outputs:

RGBA(0,0,0,1)

 

But when I use that as the color value for something I get "Expected Color Value". My workaround is to put the "RGBA" text on the outside and then pull in the values for the numbers individually:

RGBA(
 LookUp('App Style Guide',Name = "App Bar Fill").R,
 LookUp('App Style Guide',Name = "App Bar Fill").G,
 LookUp('App Style Guide',Name = "App Bar Fill").B,
 LookUp('App Style Guide',Name = "App Bar Fill").A
)

 

Categories:
  • Suggested answer
    CarlosFigueira Profile Picture
    on 29 Jan 2025 at 17:37:04
    Using String in RGBA format as Color Value
    If you have the color in the RGBA(<number>, <number>, <number>, <number>) format, you can use an expression like the one below to extract the components and create the color:
    With(
        Match(
            LookUp('App Style Guide',Name = "App Bar Fill").RGBA,
            "RGBA\(\s*(?<r>\d+)\s*,\s*(?<g>\d+)\s*,\s*(?<b>\d+)\s*,\s*(?<a>[\d\.]+)\s*\)"),
        RGBA(Value(r),Value(g),Value(b),Value(a))
    )
    If you already have the components in your 'App Style Guide' table, you can use a With call to make the expression a little simpler:
    With(
      { fillColor: LookUp('App Style Guide',Name = "App Bar Fill") },
      RGBA(fillColor.R, fillColor.G, fillColor.B, fillColor.A)
    )
    Hope this helps!
  • IPC_ahaas Profile Picture
    1,272 Super User 2025 Season 1 on 27 Jan 2025 at 14:44:22
    Using String in RGBA format as Color Value
    Unfortunately converting or storing the values as HEX seems to be the only solution. My resulting code looks like this:
     
     
    ColorValue(LookUp('App Style Guide', Name = "App Bar Fill").'Color HEX')
  • Verified answer
    MichaelFP Profile Picture
    1,831 Super User 2025 Season 1 on 26 Jun 2024 at 14:07:49
    Re: Using String in RGBA format as Color Value

    Why you store as hexadecimal value and using ColorValue("#FFFFF") to set the color?

     

    If my answer helped you, please give me a thumbs up (๐Ÿ‘). If solve your question please mark as solution โœ”๏ธ. This is help the community.

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

#1
WarrenBelz Profile Picture

WarrenBelz 146,776 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard
Loading started