GitXplorerGitXplorer
b

ninja-mode

public
3 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
fbaa903273601c6b2cbcc088ff5215b81892093e

🥷🏻

bborisdiakur committed a month ago
Verified
8fc9774454c08d21c02ece2da90b5b271ced020c

🥷🏻

bborisdiakur committed a year ago
Verified
6a076e875f8a0f98d8348fa18c92ccb0cc8a03ef

🥷🏻

bborisdiakur committed a year ago
Verified
88df62fe7fffb6b6f2a1e9e96f56797cc22bb724

🥷🏻

bborisdiakur committed a year ago
Verified
58aaa2e4c992ebf26afe7866745ee9b655b11b5c

🥷🏻

bborisdiakur committed a year ago
Verified
97a57fbe39fcbc47def5b19164e42f8d1fc90e7a

🥷🏻

bborisdiakur committed a year ago

README

The README file for this repository.

Ninja Mode

Dark mode enabled
Finally, eyes at ease
Wandering the dusk

Installation

Chromium based browsers

  1. Download the source code of this repository.
  2. In your browser go to chrome://extensions/ or opera://extensions/ or use the Cmd/Ctrl Shift E shortcut.
  3. Enable the "Developer Mode".
  4. Click the "Load Unpacked" button.
  5. Select the directory of the downloaded extension.

Firefox and similar

  1. Download the source code of this repository.
  2. Run mkdir -p build && cp -r src build/src && cp -r icons build/icons && cp manifest-ff.json build/manifest.json && cd build && zip -r -FS ../ninja-mode.zip * inside the project root directory (on Windows you'll have to figure this one out by yourself).
  3. In your browser go to about:config.
  4. Search for xpinstall.signatures.required and set it to false.
  5. Go to about:addons.
  6. Click the gearwheel and then on "Install Add-on From File".
  7. Select the ninja-mode.zip file in the project root directory.
  8. In the plugin settings, make sure the setting "Access your data for all websites" is enabled.

How it works

The extension uses a content script which runs on document start, meaning that the script is run before the DOM is constructed. This is important, as it allows to change styles, before the page is rendered, effectively preventing a bright flash on load. It uses localStorage to persist the user's preference for each page: A boolean variable is persisted, if the user enables ninja mode, and is deleted if the user disables ninja mode. The content script communicates with a background script which updates the visual state of the extension's toggle button. The background script notifies the content script when the user clicks the toggle, which then in turn updates the styles on the page. When enabled, the content script adds a CSS filter which inverts colors and rotates the color hue by 180° of the html element and again inverts colors and rotates the color hue by 180° of all image like elements.