[WP Theme Error]Blogus Header don’t change color in dark theme

Blogus Header doesn’t change color in dark theme: This is a question raised by a user. I provide solutions here.

What’s the problem?

Hellow. Coud you help me? When i choose dark them my header doesn’t change color.

denid1998

As illustrated in the snapshot: the website’s navbar didn’t change color when visitors clicked “dark mode” until it used my js code.

Code to solve “Blogus Header don’t change color in dark theme”

Just add this js on you page and it will work:

var switchElement = document.getElementById('switch');
var navbarLinks = document.querySelectorAll('#navbar-wp ul li a');

switchElement.addEventListener('click', function() {
  for (var i = 0; i < navbarLinks.length; i++) {
    if (navbarLinks[i].style.color === 'rgb(255, 255, 255)') {
      navbarLinks[i].style.color = '';
    } else {
      navbarLinks[i].style.color = '#fff';
    }
  }
});

Support My Work

If you enjoy my content, consider buying me a coffee or shopping through my Rakuten link to support me!

Victor

Founder of WPUtopia.com🕵️I would appreciate it if you could leave me a comment!

Send Message

Chat with me

Start a Conversation

Hi! Let's connect on your preferred platform.