A browser extension that prevents the flash of light content (FOLC) when using dark mode. This extension applies temporary dark styles to websites until their own stylesheets or scripts load, ensuring a smooth browsing experience for users with dark themes enabled.
- Automatically applies a dark background and text color during the initial page load.
- Hides bright elements (e.g., images and videos) temporarily to reduce light flashes.
- Compatible with the browser’s prefers-color-scheme setting.
- Lightweight and simple to use.
- Open Firefox and navigate to about:debugging.
- Click This Firefox in the left menu.
- Click Load Temporary Add-on.
- Select the manifest.json file from the project folder.
- The extension will be installed temporarily for the current browser session.
- Zip the extension files:
zip extension.zip content.js dark-theme.css manifest.json options.html options.js
- Install the .zip file directly in Firefox (requires Developer or Nightly builds for Manifest V3).
Coming soon! This extension will be available on the Mozilla Add-ons store for easy installation under the following link: https://addons.mozilla.org/en-US/firefox/addon/dark-theme-prevent-flash-fouc/
- Enable dark mode in your operating system or browser settings.
- The extension will automatically apply dark styles during page loads.
- Use the options page to customize background and text colors or manage additional settings.
manifest.json
: Defines the extension’s metadata and configuration.content.js
: Injects temporary dark styles during the page load.dark-theme.css
: Contains the CSS rules for the temporary dark mode.icon.png
: The extension’s icon.options.html
&options.js
: Allow users to customize the extension’s settings.
- Clone the repository:
git clone https://github.com/nicolasdanelon/avoid-fouc-when-dark-theme
cd avoid-fouc-when-dark-theme
- Make changes to the files.
- Test the extension by loading it as a temporary add-on in Firefox (about:debugging).
Contributions are welcome! If you have suggestions, bug reports, or feature requests, feel free to open an issue or submit a pull request.
This extension is licensed under the MIT License.