question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Color changes only on page load, and flashes on a website

See original GitHub issue

Great extension! I LOVE IT.

One thing I’ve noticed though: in my website I have a dark mode switch. I’m gonna use it to describe the behavior I’m experiencing.

A little background: my system, Firefox and the extension are working on dark mode right now (it’s night time here at the moment of testing the extension). I have the Dark Reader extension installed, but I disabled it completely from Firefox extensions to track down the problem properly.

I got 2 problems:

  • When I’m in dark mode in the website, everything works fine. However, if switch to the light theme, it doesn’t change the tab colors right away. I need to refresh or get into a link to make it change.
  • If I leave it in light mode, it flashes in dark and then goes to the proper color again (light).

I can tell you that the meta theme-color in my website is set via javascript at the very beginning of loading the website. The flashing problem does not happen in Chrome or similar browsers in Android where the tabs color changes according to the current webpage theme, and they switch dynamically as well.

I could say that the flashing problem might be because the theme-color tag is being processed a few milliseconds late, but still the javascript code is running even before the DOM is processed I guess. The problem does not happen in Android browsers because they process the theme-color tag a bit late and, in the meantime they retain the previous color, I guess?

EDIT: the flash issue seems to happen, at least to me, in the homepage, here, and any product page. It does not happen, however, here, or at least not so frequently, which may hint a race condition problem as I mentioned.

And an optional issue, which I don’t really know if that’s part of the scope of what the extension is able to do:

  • The SVG favicon in my webpage is able to switch between dark and light mode depending on the system color scheme (I’m guessing more precisely Firefox color scheme). So, it won’t change according to the current theme chosen in the website, which is desirable given that it has to go along the color scheme of the whole browser. Thing is, the extension does change the whole look of the borders and tabs.

Does it have the ability to switch the SVG colors in the favicons? To give more information, SVG uses the media query (prefers-color-scheme: dark) to change the fill color within the icon. It is embedded in the SVG file.

Thank you!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
YS-Wongcommented, May 31, 2022

@Arecsu the add-on is now responsive to color scheme switching on your website (needs “dynamic color update” turned on).

1reaction
Arecsucommented, Apr 28, 2022

Ok, I think I solved this issue in the most simple and “dirty” way:

// background.js
if (response == undefined) {
  // checks if it's an about or addons.mozilla.org
  if (url.startsWith("about:") || url.startsWith("addons.mozilla.org")) {
    resetFrameColor(windowId);
  }
console.log("NO CONNECTION TO CONTENT SCRIPT\nMay be about:pages");
}

😃

So far, no flashing problems at all and everything works just fine. Gonna to make a pull request!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get rid of flash of colour when website loads
When loading my site at https://latestfooty.co.uk, there's always a flash of grey before the site loads. The site is a relatively lightweight ...
Read more >
Default background colour flashing during page load. Cannot ...
It only flashes for a second while loading, but when the page itself is white, a dark grey flash is really distracting.
Read more >
Light/dark mode: avoid flickering on reload
This can result in a flicker when users visit your website: they picked the dark mode, but when loading the website, for a...
Read more >
Topic: How do I remove the reload "flash" when ... - Themeco
1. The reload flash, which in and of itself is part of the nature of web design, should not be visible in a...
Read more >
Socket background colour "flashes" during page load - Kriesi.at
When switching between pages, the background colour of the socket flashes on the screen. Depending on load times it can be just an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found