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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...