Finally, eyes at ease
Wandering the dusk
- Download the source code of this repository.
- In your browser go to chrome://extensions/ or opera://extensions/ or use the
Cmd/Ctrl Shift E
shortcut. - Enable the "Developer Mode".
- Click the "Load Unpacked" button.
- Select the directory of the downloaded extension.
- Download the source code of this repository.
- 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). - In your browser go to about:config.
- Search for
xpinstall.signatures.required
and set it tofalse
. - Go to about:addons.
- Click the gearwheel and then on "Install Add-on From File".
- Select the
ninja-mode.zip
file in the project root directory. - In the plugin settings, make sure the setting "Access your data for all websites" is enabled.
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.