Adding colour to your charts in Splunk dashboards is a simple change that can make your dashboards more effective. Splunk already adds colours using a default colour scheme. However, by using your own colour scheme you can give extra meaning to your dashboards. You can also be sure that the same category is represented by the same colour across dashboards.

Adding colour to your charts in Splunk dashboards is done using Simple XML. Go to the ‘Edit’ mode of the relevant dashboard and select the ‘Source’ option. There are two main ways to add colours to your dashboards.

Adding a list of colours to your charts

This option allows you to specify any number of colours as a palette. Splunk will match values to colours in the order in which they appear in the list. This is the default way that charts are coloured in Splunk.

Go to the section of the Simple XML which represents the chart you wish to edit, and paste the following:

        <option name="charting.seriesColors">[0xEBF0F5,0xC2D1E0,0x99B2CC,0x7094B8,0x4775A3,0x2E5C8A,0x24476B,0x1A334C,0x0F1F2E,0x050A0F]</option>

Be sure to replace the hex codes with those of the colours you want to add. Splunk will go through this list in order for each field that it encounters that hasn’t yet been assigned a colour. Note that Splunk recognises both “0x” and “#” versions of hex codes.

Adding specific colours to your charts

This option allows you to map colours to specific values in your data. This is useful if you have specific colour(s) that would be associated by your users with certain field(s).

Go to the section of Simple XML for the chart you want to edit, and insert the following:

    <option name="charting.fieldColors">{"Myths of Music":#2D6A8B,"Creature Village":#F6AE2D,"Princesses and Castles":#893168}</option>
    

Replace the field name, (e.g. ‘Myths of Music’), with the name you want to use, and change the hex code as appropriate. The field name must match exactly with the field name in the data, so if it isn’t working, make sure that these are identical.

How to choose colours for your dashboards

When choosing colours to use on your dashboards, it’s best not to go overboard! You should select a few colours to use, and use the shade or intensity to convey meaning. There are a variety of tools online to help with this. For example, Google has a built in simple colour picker, or for more advanced options you can use imagecolorpicker.com or coolors.co.

Be aware that some of your dashboard users may be colour blind. To make your dashboards accessible, avoid relying on colours alone to convey meaning. Also, check that any colours you display together can be told apart by all users. Use tools such as coolors.co to see how colours and palettes appear to users with different forms of colour blindness.

If you are interested in adding colour to tables in your dashboard, take a look at our earlier blog post on this topic.


For 2021 we’ve committed to posting a new Splunk tip every week!

If you want to keep up to date on tips like the one above then sign up below:

Subscribe to our newsletter to receive regular updates from iDelta, including news and updates, information on upcoming events, and Splunk tips and tricks from our team of experts. You can also find us on Twitter and LinkedIn.

Subscribe

* indicates required

Posted by:Becky Nielsen

Becky is a certified Splunk Admin, who has been working for iDelta since graduating from CodeClan's Professional Software Development course in 2019. Previously an archivist at several institutions around the UK, she holds an MSc in Information Management and Preservation from the University of Glasgow.