cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Field
Level 8

Can't get label colour value

I have a label with a specific colour.

I want (with another label), to show the RGBA of that color.

If i use Label1.Color, it will give me an error and it wont work.

 

What should i do in this case?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Can't get label colour value

Thanks for clarifying @Field 

 

If you have a limited number of Colors that you are going to choose from, then you could do it with a comparison as I showed and then have it display text based on the comparison. However if it can be Any colour, then there's currently no way to do this sort of comparison (I tried, really)

 

I investigated a bit further and was able to determine that Color.??? is not comparable to Hex or RGBA values (which is very frustrating), as if they were, then my idea was to pull the entire table of colours from here in the App onload (which I did), and have it check against values in the table.. sadly the result of trying to do comparitives between the table was along the following lines:

image.png

 

HOWEVER

 

image.png

I have a kind of solution, although it does assume that your users have not chosen any custom colours. Using the default colours, I was able to then do a Switch against that value, to display the RGBA Value (Please see attached .msapp file).
So if your app fits the parameters (ie users are only going to choose from the default color picker and not choose custom colours), then this will work Cat Very Happy

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

8 REPLIES 8
shailendra74
Level 10

Re: Can't get label colour value

Hi @Field 

 

To set the color of a Label1 to another Label2, set the "Color" property of Label2 to Label1.Color

 

In case you want to capture in any variable (onselect of a button or on screen visible, 

 

UpdateContext({lblColor: Label1.Color})

 

 

Thanks.

Dual Super User
Dual Super User

Re: Can't get label colour value

hI @Field 

 

I do not belive you can set the Color property of one label as text for another

The data type is RGBA code and does not get set to a text property

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Field
Level 8

Re: Can't get label colour value

Hi @RezaDorrani ,

 

Is there atleast a way to tell me if the color is White, black or blue (Or whatever color is the label)

 

Thank you

Super User
Super User

Re: Can't get label colour value

Hi @Field 

 

You can do comparisons between set colours and either a ColorValue hex code or a RGBA value or a Colour:

 

//This checks for the luminous green value based on hex code

If(Rectangle1.Fill = ColorValue("#00FF00"), true, false)

Or for RGBA:

 

If(Label3.Fill = RGBA(152, 208, 70, 1), true, false)

 

Or you can also compare against PowerApps Set colours:

If(Label3.Fill = Lime, true, false)

I have tested this and confirmed that all three options provide valid true/false values for matching colours.

 

Is this what you were looking to achieve?

 

Cheers,

@iAm_ManCat 

 




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
Field
Level 8

Re: Can't get label colour value

Hi,

Altough it might be usefull, it wasn't really what i wanted to achieve.

 

I have 2 labels. In label1, I have a text that's written "Please follow the form" and the color is blue.

I want in label2 to show me the Color used in label1.

Highlighted
Super User
Super User

Re: Can't get label colour value

Thanks for clarifying @Field 

 

If you have a limited number of Colors that you are going to choose from, then you could do it with a comparison as I showed and then have it display text based on the comparison. However if it can be Any colour, then there's currently no way to do this sort of comparison (I tried, really)

 

I investigated a bit further and was able to determine that Color.??? is not comparable to Hex or RGBA values (which is very frustrating), as if they were, then my idea was to pull the entire table of colours from here in the App onload (which I did), and have it check against values in the table.. sadly the result of trying to do comparitives between the table was along the following lines:

image.png

 

HOWEVER

 

image.png

I have a kind of solution, although it does assume that your users have not chosen any custom colours. Using the default colours, I was able to then do a Switch against that value, to display the RGBA Value (Please see attached .msapp file).
So if your app fits the parameters (ie users are only going to choose from the default color picker and not choose custom colours), then this will work Cat Very Happy

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

Field
Level 8

Re: Can't get label colour value

Hello,

This was kinda what i was searching for.

Thank you

 

Super User
Super User

Re: Can't get label colour value

You're welcome João, glad to help!




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,840)