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
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...