All files / entrypoints/sidepanel main.tsx

0% Statements 0/16
0% Branches 0/1
0% Functions 0/1
0% Lines 0/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17                                 
import React from "react";
import ReactDOM from "react-dom/client";
import { App } from "./App";
import "../../assets/main.css";

// Apply dark class before first paint to avoid flash
const stored = localStorage.getItem("theme-preference");
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
const isDark = stored === "dark" || (stored !== "light" && prefersDark);
document.documentElement.classList.toggle("dark", isDark);

ReactDOM.createRoot(document.getElementById("root")!).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);