Dashboards & Visualizations

Why does dark theme switch fail when using emojis in the dashboard?

D2SI
Communicator

Hello there!

I am working on a App I am willing to publish on Splunkbase.

I do like the dark mode one click feature so I try to adapt CSS colors based on currently applied theme, so that users will be able to pick dark theme without having light colors left on the dashboard.

It is working fine so far using a background rest search that checks for dashboard's theme and tokens.

However, I do use emojis in my dashboards and I have discovered that it makes the dark mode switch fail:

screen4.png

It might be a core issue so I guess I will have to live with it but I am posting there just in case anyone figured this out, maybe there is a way to escape / protect emoji or the like.

 

 

<dashboard theme="dark">
  <label>Emoji Dark Mode</label>
  <row>
    <panel>
      <html>
        
      </html>
    </panel>
  </row>
</dashboard>

 

 

PS: Code renderer also seems to dislike emojis but there is one one emoji within html :

<html>
😐
</html>

 

 

Labels (3)
0 Karma
1 Solution

niketn
Legend

@D2SI this is a known issue with Unicode Characters, with easy workaround 😂

2020-07-20	SPL-192213	Dark mode does not get applied to XML dashboards when using unicode characters like smiley icons

Workaround:
Do not use unicode characters in Dashboards with dark mode.

In case you want to use icons go for Simple XML JS extension or use standard icon libraries like  Font-Awesome: https://fontawesome.com/

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

splunklearner
Communicator

@D2SI @andrewtrobec @robtun1 @blablabla @niketn can you guys help me on this as well... Re: How to add the description for dashboard in be... - Splunk Community

I am trying to add ⚠️ in my Splunk dashboard description and as soon as I give this HTML, dark theme changing to light and it is not returning. Can you guys help me?

0 Karma

blablabla
Path Finder

This bug also happens (on Splunk Enterprise 8.2.3.3) when using a XML Declaration like

<?xml version="1.0" encoding="UTF-8"?>

Took us a while to figure this out

0 Karma

andrewtrobec
Motivator

Came across this problem too.  No issues in 7.3.x, after upgrade to 8.0.5 it started failing.  I guess it's a regression.

0 Karma

D2SI
Communicator

Nice workaround indeed 😂

0 Karma

niketn
Legend

@D2SI this is a known issue with Unicode Characters, with easy workaround 😂

2020-07-20	SPL-192213	Dark mode does not get applied to XML dashboards when using unicode characters like smiley icons

Workaround:
Do not use unicode characters in Dashboards with dark mode.

In case you want to use icons go for Simple XML JS extension or use standard icon libraries like  Font-Awesome: https://fontawesome.com/

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

robtun1
Explorer

managed by luck to find a workaround for this. 

0 Karma

andrewtrobec
Motivator

Splunk: "yeah, don't do that" 

Tags (1)
0 Karma

robtun1
Explorer

Saw this and managed to create a workaround because I didnt like the cursor moving etc.

 

So I wrapped the function within a search macro and now the dark theme also works when you call the macro instead of having emojio embedded into your dashboard! 

 

e.g. 

eval $arg1$=case($arg1$==1,"🥇",$arg1$==2,"🥈",$arg1$==3,"🥉",1==1,$arg1$)

 

robtun1_0-1691052834679.png

 

andrewtrobec
Motivator

This works for me too, nice one! @D2SI I would suggest this being the solution.

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