Dashboards & Visualizations

Table cell font colour (color) changing depending on cell background colour

mscomms
Path Finder

Hi All,

I have a stats table which I have set up to use as an alarm display where each line is coloured to donate the severity.

This is working fine except that when the table row colour is red or blue the text in the cells is white which my users don't like they want the text to stay black for all background colours.

This seems to be a default behaviour, I have looked round the documentation and asked my friend google but cant fins a way to suppress it.

Can anyone point me towards a solution.

Cheers Mike

Labels (1)
0 Karma

mscomms
Path Finder

I think I have foungd it you need the !important after the color: black

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Yes, that's what I showed as I thought you may have forgotten it 😀

0 Karma

mscomms
Path Finder

On my live dashboard the css is in the simplexml 

0 Karma

mscomms
Path Finder

This is an example dashboard showing the issue

<dashboard>
  <label>Text Colour</label>
  <row>
    <panel>
      <table>
        <title>Colour vs text</title>
        <search>
          <query>| makeresults | eval whiteBg="White Background", redBg="Red Background" | table whiteBg redBg</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <format type="color" field="redBg">
          <colorPalette type="map">{"Red Background":#FF0000}</colorPalette>
        </format>
      </table>
    </panel>
  </row>
</dashboard>

 

You can see the whiteBG has black text and the redBG has white text, I have raised a case on this as well

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
<dashboard>
  <label>Text Colour</label>
  <row>
    <panel>
      <html>
        <style>
          #table td {
            color: black !important;
          }
        </style>
      </html>
      <table id="table">
        <title>Colour vs text</title>
        <search>
          <query>| makeresults | eval whiteBg="White Background", redBg="Red Background" | table whiteBg redBg</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <format type="color" field="redBg">
          <colorPalette type="map">{"Red Background":#FF0000}</colorPalette>
        </format>
      </table>
    </panel>
  </row>
</dashboard>

ITWhisperer_0-1623160005105.png

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Have you tried using CSS to set the colour to black for the table data cells?

0 Karma

mscomms
Path Finder

@ITWhisperer Yes I have tried that, the colour seems to change as the colour saturation increases

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Can you share your SimpleXML for this? Do you have the CSS in the SimpleXML or separately in a .css file?

0 Karma

mscomms
Path Finder

Example of font colour attached 

Image showing change in font colourImage showing change in font colour

0 Karma
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 ...