How to add darkmode support to apps

The code below enables web-apps to be working in dark/light mode. It needs to be added to the app settings custom code header.

<script src="https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js"></script>
<script>
  function addDarkmodeWidget() {
    new Darkmode().showWidget();
  }
  window.addEventListener('load', addDarkmodeWidget);
</script>
4 Likes

I know this is an older thread, but I just wanted to say thanks. This works great. And even if you aren’t paying for the basic package that gives you access to custom code, you can work around that by using the Google Tag Manager integration.

1 Like