PocketBase Dark Mode

Adds a simple css inject that inverts the colors except for images on PocketBase UI.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        PocketBase Dark Mode
// @namespace   ModLabs
// @version     1.0.0-GitHub
// @description Adds a simple css inject that inverts the colors except for images on PocketBase UI.
// @license     Apache License 2.0
// @author      ModLabs
// @match       *://*/*
// @grant       none
// ==/UserScript==

const isPocketBaseAdminPage = () =>
  !!document.querySelector(
    'link[rel="prefetch"][href="./libs/tinymce/skins/ui/pocketbase/skin.min.css"][as="style"]'
  );

let pbIntervalId = null;

if (isPocketBaseAdminPage()) {
  pbIntervalId = setInterval(() => {
    if (!document.querySelector("#pb_dark_mode_patch")) {
      const el = document.createElement("style");
      el.id = "pb_dark_mode_patch";
      el.textContent = `
        body { filter: invert(1); }
        img  { filter: invert(1); }
      `;
      document.head.appendChild(el);
    }
  }, 1);
}