web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Different text colours...
Power Apps
Unanswered

Different text colours in concatenation string?

(0) ShareShare
ReportReport
Posted on by 1,599 Super User 2024 Season 1

Hello,

 

I was wondering if I can have different colours in a concatenation string on an HTML Text control?

 

Concatenate("Modified By: ",galDocData.Selected.'Modified By'.DisplayName," on ",galDocData.Selected.Modified)

 

Essentially, Id like the Modified By and Modified to be Yellow and the rest White.

Categories:
I have the same question (1)
  • Chris-D Profile Picture
    1,246 on at

    Yes, you can use the CSS style property on HTML tags:

     

    Black <span style='color: red'>Red</span> <span style='color: green'>Green</span> <span style='color: blue'>Blue</span>

     

     

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @Chris-D where would I insert the CSS style properties in my code above??

  • AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @sudosaurus can you try using inline styles? for an example:

     

    "Modified By:"&"<p style='color:Yellow;'>"&Label1.Text&"<p> On "&"<p style='color:Yellow;'>"&Label2_2.Text&"<p>"

     

     

    AndrewR1_1-1694774290620.png

     


    You would need to change the inputs to be yours but this should give you an idea on how to concatenate a HTML String. 

    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.

     

    Many Thanks
    Andrew






  • Chris-D Profile Picture
    1,246 on at

    I prefer the $ syntax for long strings, I think it's more readable:

    $"Modified By: <span style='color: yellow'>{Label1.Text}</span> On <span style='color: yellow'>{Label2_2.Text}</span>"

     

    @AndrewR1, use SPAN tag, not P, and to close a tag use /. Your HTML is poorly formatted.

     

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @AndrewR1 can I not just refer to column names in the list rather than referencing labels in the app?

     

    I've tried this but it doesnt seem to work:

     

    Concatenate("Modified By: ,"<p style='color:Yellow;'>galDocData.Selected.'Modified By'.DisplayName<p>," on ",<p style='color:Yellow;'>galDocData.Selected.Modified<p>)
  • AndrewR1 Profile Picture
    1,572 Moderator on at

    Yes you can use column names as the inputs I just use labels as an example! can i ask why are you using Concatenate? can you try this for the HTML Text: 

    "Modified By: ,<p style='color:Yellow;'>"&galDocData.Selected.'Modified By'.DisplayName&"<p>, on <p style='color:Yellow;'>"&galDocData.Selected.Modified&"<p>"

     

    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.

     

    Many Thanks
    Andrew

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @AndrewR1 

    I used concatenate originally on a label to display two text values.

     

    sudosaurus_0-1694776676426.png


    Is there any way I can display this horizontally though?

     

    Modified By: Chris Cundy on 13/09/2023 20:55

  • Chris-D Profile Picture
    1,246 on at

    Yes, use my code. Use SPAN instead of P. 

  • Verified answer
    AndrewR1 Profile Picture
    1,572 Moderator on at

    @Chris-D is correct us span not p sorry 

     

    "Modified By: ,<span style='color:Yellow;'>"&galDocData.Selected.'Modified By'.DisplayName&"</span>, on <span style='color:Yellow;'>"&galDocData.Selected.Modified&"</span>"

     

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    Thanks @AndrewR1 and @Chris-D for your efforts - we got there in the end and I learnt something!!

    sudosaurus_0-1694777251388.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard