cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Field
Helper V
Helper V

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

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

@iAm_ManCat
My blog

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

8 REPLIES 8
Anonymous
Not applicable

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.

RezaDorrani
Community Champion
Community Champion

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

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

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 

 

@iAm_ManCat
My blog

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


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.

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

@iAm_ManCat
My blog

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Hello,

This was kinda what i was searching for.

Thank you

 

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

@iAm_ManCat
My blog

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Top Solution Authors
Top Kudoed Authors
Users online (4,182)