cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SKirkby
Level: Powered On

Change text colour of individual characters in same label

Originally in my app the asterisk's were all in red and the text was in black. I've had to change the text to depend on what a global variable is set to.

 

e.g. if variable=0 then language 1, else if variable=1 then language 2..

 

This means that all the text is back to black and I can't seem to figure out how to have just the asterisk's in red and the rest of the text in black.

 

When I first made the app earlier this year I think I just highlighted the asterisk and then selected the colour red. But for one that isn't working now, and even if it was working it wouldn't work in this case as the text is now based on code.

 

Some insight to this would be great because I'm confused on how to do it.

 

Form.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Change text colour of individual characters in same label

@SKirkby 

PowerApps will only allow a single color in a label field.  The simplest solution here is to make a separate label for the asterisk and change its color.  This is what PowerApps does by Default when an Edit Form is created.

 

Let me know if this works.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Change text colour of individual characters in same label

@SKirkby 

PowerApps will only allow a single color in a label field.  The simplest solution here is to make a separate label for the asterisk and change its color.  This is what PowerApps does by Default when an Edit Form is created.

 

Let me know if this works.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Super User
Super User

Re: Change text colour of individual characters in same label

Hi @SKirkby 

As @mdevaney says, the easiest way is to add another label with the asterisk.

Another alternative is to use a HTML Text control, rather than a label. You would use markup that looks like this:

 

"First name <font color=red>*</font>"

 

 

image.png

With internationalization, a problem is that words can often be longer when you switch languages. Using HTML can help avoid any irregular spacing when you switch languages, compared to using separate labels.

Super User
Super User

Re: Change text colour of individual characters in same label

@timl

Agreed.  That is another totally valid way of doing things and is a 100% solution.  My preference between the two comes down to the ability to make the asterisk not visible once the required field is filled-in by using this code in the label.  Its a minor form design feature I like to incorporate

 

Visible: IsBlank(your_text_input_field_name);

 

Seeing the multiple solutions to problems is part of why I like coming to the forum.  Thanks for the alternative solution!

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

SKirkby
Level: Powered On

Re: Change text colour of individual characters in same label

@mdevaney @timl 

 

I've decided to just create additional labels and place them at the end of the text. Then I updated the x/y position of the labels depending on what the variable is set to so the position is adjusted when the language changes. 

 

Thank you both for your solutions! I've given kudos to you both.

 

 

Super User
Super User

Re: Change text colour of individual characters in same label

It's great to see some great ideas in this post - toggling the visibility of labels and setting x/y co-ordinates dynamically. Thanks again for all your valuable contributions here @mdevaney  🙂

 

 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,559)