cancel
Showing results for 
Search instead for 
Did you mean: 

Blox - Color format words in text string

Dennis_M
9 - Travel Pro
9 - Travel Pro

Hello Sisense Community,

Despite on-line HTML references, I cannot properly code a BloX "text" string to change color of specific words in the text line.  I'm sure this is straightforward coding; can't find an example in other BloX templates.  I have attached picture of widget for reference plus code snippet.  I have so much to learn.  Thanks in advance for your help. - D 

"items": [
                {
                    "type": "TextBlock",
                    "size": "large",
                    "horizontalAlignment": "center",
                    "spacing": "Large",
                    "weight": "default",
                    "text": "Leader: {panel:Leader}",   -- Looking to custom color format {panel: Leader}

                    "style": {
                        "text-align": "center",
                        "font-weight": "default",
                        "font-size": "30px",
                        "background": "#124C87",
                        "color": "white"
                    }
                }
            ]

 

1 ACCEPTED SOLUTION

harikm007
13 - Data Warehouse
13 - Data Warehouse

@Dennis_M 

One option is to enclose {panel:Leader} within <span> tag:

"items": [
                {
                    "type": "TextBlock",
                    "size": "large",
                    "horizontalAlignment": "center",
                    "spacing": "Large",
                    "weight": "default",
                    "text": "Leader: <span style='color:yellow'>{panel:Leader}</span>",
                      "style": {
                        "text-align": "center",
                        "font-weight": "default",
                        "font-size": "30px",
                        "background": "#124C87",
                        "color": "white"
                    }
                }
            ]

harikm007_0-1646667745990.png

-Hari

 

View solution in original post

2 REPLIES 2

harikm007
13 - Data Warehouse
13 - Data Warehouse

@Dennis_M 

One option is to enclose {panel:Leader} within <span> tag:

"items": [
                {
                    "type": "TextBlock",
                    "size": "large",
                    "horizontalAlignment": "center",
                    "spacing": "Large",
                    "weight": "default",
                    "text": "Leader: <span style='color:yellow'>{panel:Leader}</span>",
                      "style": {
                        "text-align": "center",
                        "font-weight": "default",
                        "font-size": "30px",
                        "background": "#124C87",
                        "color": "white"
                    }
                }
            ]

harikm007_0-1646667745990.png

-Hari

 

Thanks Hari, the simple solution I knew existed but could not find.  Appreciate your quick response. - D

Community Toolbox

Recommended links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]