Dashboards & Visualizations

How do I add color format to HTML dashboard?

Moonveil
Explorer

Hello,

I converted a XML dashboard to HTML in Splunk 6.5, and noticed that the color format for my table is missing after the conversion. The original code in XML is as follows:

      <table id="table1">
        <search id="search1">
        ...
        </search>
        ...
        <format type="color" field="priority">
          <colorPalette type="map">{"info":#5378AD,"low":#98BF3B,"medium":#F0BE1B,"high":#FF8800,"critical":#D25B3B}</colorPalette>
        </format>
      </table>

Can someone tell me how to add color formatting to the converted HTML dashboard? Do I just add it to the table1 TableElement properties?

Thank you!

akarivaratharaj
Communicator

@here I have a similar issue with adding the HTML code for Splunk dashboard. The code is to set the color to a specific field in a panel with table representation.
I have added the below code, which is working fine for the number field

<format type="color" field="COUNT">
    <colorPalette type="minMidMax" maxColor="#D6563C" minColor="#FFFFFF">
    </colorPalette>
    <scale type="minMidMax"></scale>
    </format>

I would like to add the same code for a field which represents the time duration in the format of "HH:MM:SS". The above code is not supporting the time format.

Could anyone please help me in getting the right code to support the time format fields also.

0 Karma

sfatnass
Contributor

hi

the format option still does not work in html.

i need to use a scale coloration for a dynamic table. but it's impossible for me to define a value.

0 Karma

niketn
Legend

After converting to HTML seems like options remains empty in HTML, so seems like a bug.
"format": {"log_level": [{"type": "color", "options": {}}]},

The only example I found was for sparkline options for TableElement, and no information available for colorPalette {"INFO":#5378AD,"ERROR":#98BF3B,"WARN":#F0BE1B}. Since, the SplunkJS reference talks only about setting sparkline and not colorPalette through TableView/TableElement, I was unable to find what exact code to be put in options. Splunk should fix this and also update the Web Framework Documentation.

In your situation, I would suggest use Table Cell Highlighting example from the Simple XML Examples App to color the priority field based on values. The example use Simple XML Extensions, to introduce a custom cell render for the Table View using CSS to apply colors for specific cell values. See if that solves the need.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

frobinson_splun
Splunk Employee
Splunk Employee

Editing table formats after converting to HTML is not an officially supported usage.

Hope this helps!

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...