Dashboards & Visualizations

How to change the color of a whole panel based on a single value result in Splunk 6.2.1?

kpsg25690
Engager

Hello,

I'm creating a dashboard using Splunk 6.2.1 which will have multiple single value panels, each with a value of YES or NO and a drilldown to a different dashboard.

I am able to change the text color using the "severe" and "low" default classes and also the background color using the same, but I want to change the background of the whole panel instead of the single value component.

My xml is:

<dashboard script="hc.js" stylesheet="hc.css">
  <label>Health_Check_Dashboard</label>
  <row>
    <panel>
      <single id="one">
        <title>1 Status</title>
        <search>
          <query>index=event* sourcetype=<sourcetype> CellName=<name> | head 1| eval result=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","NO","YES") | eval class=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","severe","low") | table result,class</query>
          <earliest>0</earliest>
          <latest></latest>
        </search>
        <option name="classField">class</option>
        <option name="drilldown">none</option>
        <option name="useColors">1</option>
      </single>
    </panel>
    <panel>
        <single id="two">
        <title>2 Status</title>
        <search>
          <query>index=event* sourcetype=<sourcetype> CellName=<name> | head 1| eval result=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","NO","YES") | eval class=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","severe","low") | table result,class</query>
          <earliest>0</earliest>
          <latest></latest>
        </search>
        <option name="classField">class</option>
        <option name="drilldown">none</option>
        <option name="useColors">1</option>
      </single>
    </panel>
    <panel>
      <single id="three">
        <title>3 Status</title>
        <search>
          <query>index=event* sourcetype=<sourcetype> CellName=<name> | head 1| eval result=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","NO","YES") | eval class=if(PrimaryRunning=="NO" OR SecondaryRunning=="NO","severe","low") | table result,class</query>
          <earliest>0</earliest>
          <latest></latest>
        </search>
        <option name="classField">class</option>
        <option name="drilldown">none</option>
        <option name="useColors">1</option>
      </single>
    </panel>
  </row>
  </dashboard>

I've gone through the other examples in here and the dashboard examples and couldn't find anything that works.

Any help would be appreciated.

Thanks!

0 Karma

jnichols914
Explorer

I don't know if you figured this out already, but you want to use the following as an option "Block". When you do this, your background will change based on the colors you specified and your text will stay white.

Hope this helps,

Justin

<option name="colorBy">value</option>
 <option name="colorMode">block</option>
0 Karma
Get Updates on the Splunk Community!

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...

Splunk App Developers | .conf25 Recap & What’s Next

If you stopped by the Builder Bar at .conf25 this year, thank you! The retro tech beer garden vibes were ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...