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


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';