Dashboards & Visualizations

Is there a simple way to get the current dashboard theme in a token?

alhoctamis
Explorer

Hello!

I am trying to use less static colors as possible in a dashboard so that users could switch between dark and light mode without dashboard looking odd.

It would useful to have current theme in a token so that I could switch static colors based on chosen theme.

Too bad it is not in the env: tokens.

<form theme="light">
  <label>Dashboard</label>
  ...

Any idea?

Labels (2)
0 Karma
1 Solution

alhoctamis
Explorer

It is possible by parsing view data using a background search:

  <search>
    <query>| rest splunk_server="local" /servicesNS/-/-/data/ui/views search="eai:acl.app=<app_name> label=<view_label>"
| rex field="eai:data" "theme\=\"(?&lt;theme&gt;.+?)\""
| stats values(theme) as theme</query>
    <earliest>0</earliest>
    <latest></latest>
    <done>
      <set token="theme_tok">$result.theme$</set>
    </done>
  </search>

 

View solution in original post

0 Karma

alhoctamis
Explorer

It is possible by parsing view data using a background search:

  <search>
    <query>| rest splunk_server="local" /servicesNS/-/-/data/ui/views search="eai:acl.app=<app_name> label=<view_label>"
| rex field="eai:data" "theme\=\"(?&lt;theme&gt;.+?)\""
| stats values(theme) as theme</query>
    <earliest>0</earliest>
    <latest></latest>
    <done>
      <set token="theme_tok">$result.theme$</set>
    </done>
  </search>

 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...