cancel
Showing results for 
Search instead for 
Did you mean: 

Blox - Color format words in text string

Dennis_M
8 - Cloud Apps
8 - Cloud Apps

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
12 - Data Integration
12 - Data Integration

@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
12 - Data Integration
12 - Data Integration

@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

Voice of Customer
Impact Business Intelligence (BI) and Analytics Market Research

Click Here & Complete Dresner's Wisdom of Crowds® Market Study Survey Today!

Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Need additional support?:

Community Support Request

Don't miss out:

Earn a BETA Launch Challenge Badge!