Code Monkey home page Code Monkey logo

darkreader's Introduction

Dark Reader's mascot

Dark Reader analyzes web pages and aims to reduce eyestrain while browsing the web.


Chrome Web Store Firefox Add-ons Apple App Store Edge Addons Thunderbird

Dark Reader


Dark Reader is an open-source MIT-licensed browser extension designed to analyze web pages. Dark Reader will generate a dark mode that aims to reduce the eyestrain of the user. Dark Reader is feature-rich and is customizable in many ways throughout the UI.



Questions

Most questions can be answered by reading the help page. If the help page doesn't answer your question, open up a new discussion.

How to contribute

Read more about contributing to Dark Reader in CONTRIBUTING.md.

Building for use

Dark Reader build script requires a JavaScript runtime, either NodeJS or Deno. We recommend using NodeJS, Deno support is experimental.

Building with NodeJS

You can install the extension from a file. Install Node.js (we recommend LTS or higher, but any version at or above 15 will work). Download the source code (or check out from git). Open the terminal in the root folder and run:

  • npm install
  • npm run build or npm run build [-- flags]

This will create a build/release/darkreader-chrome.zip file for use in a Chromium-based browser and a build/release/darkreader-firefox.xpi file for use in Firefox.

You can customize build process by passing flags to build script. To see all flags, run npm run build -- --help.

Building with Deno

You can build Dark Reader with alternative runtime called Deno. For this run deno:bootstrap script (e.g., via npm run deno:bootstrap or manually copy the command from package.json). Then run the same commands described above.

Please note that if you encounter error Too many open files (os error 24), then you should use the newer version of Deno (preferably built from source or canary).

Bundling with official Firefox store signatures (experimental)

Prior to publication, extension stores provide digital signatures for extensions. These digital signatures certify the integrity of the archive (that extension bundle did not get corrupted or bit-rotted) and that extension store performed very basic extension validation.

Dark Reader repository contains these digital signatures and you can add them to the extension bundle. The following will build Dark Reader for Firefox version 4.9.63:

npm run build -- --firefox --version=4.9.63

Please note that only Firefox Add-ons store signatures are present in the repositiry right now. Also, due to NodeJS and TypeScript version compatibility, one might have to first check out the old revision (commit), then build the extension files, then check out the recent commit and create the bundle (by running only signature and zip steps).

Using Dark Reader for a website

You can use Dark Reader to enable dark mode on your website!

  • Install the package from NPM (npm install darkreader)
  • or build from the source code (npm run api)
  • or include the script via a CDN such as unpkg or jsDelivr

Then you can use the following code to control Dark Reader's API:

DarkReader.enable({
    brightness: 100,
    contrast: 90,
    sepia: 10
});

DarkReader.disable();

// Enable when the system color scheme is dark.
DarkReader.auto({
    brightness: 100,
    contrast: 90,
    sepia: 10
});

// Stop watching for the system color scheme.
DarkReader.auto(false);

// Get the generated CSS of Dark Reader returned as a string.
const CSS = await DarkReader.exportGeneratedCSS();

// Check if Dark Reader is enabled.
const isEnabled = DarkReader.isEnabled();

... or if you are using ES modules:

import {
    enable as enableDarkMode,
    disable as disableDarkMode,
    auto as followSystemColorScheme,
    exportGeneratedCSS as collectCSS,
    isEnabled as isDarkReaderEnabled
} from 'darkreader';

enableDarkMode({
    brightness: 100,
    contrast: 90,
    sepia: 10,
});

disableDarkMode();

followSystemColorScheme();

const CSS = await collectCSS();

const isEnabled = isDarkReaderEnabled();

Be aware that Dark Reader will add the chrome object onto the window object. These are to stub certain functions that the code will use. They originate from the webextension-api.

Site fixes

Automatically syncing the site fixes to every Dark Reader user was disabled because the GitHub team does not allow using GitHub as a CDN. The storage of these files would be expensive, and making requests to other resources would look suspicious. Each new release of Dark Reader will include these changes.

However, this can be enabled using the following steps:

  • Click on the Dark Reader icon.
  • Click on the Dev tools button (in the bottom-right corner).
  • Click on the Preview new design button.
  • Enable the Synchronize site fixes setting under Settings -> Manage settings.

To force a synchronization of the sites fixes (when the corresponding setting is enabled), perform the following steps:

  • Click on the Dark Reader icon.
  • Click on the Dev tools button (in the bottom-right corner).
  • Click on the Reset button. This will remove any custom site fixes you may have.

Enable Dark Reader for restricted websites on Firefox

By default, Dark Reader does not work on some websites due to security restrictions enforced by Mozilla.

The following instructions will guide you on how to bypass those restrictions.

Proceed with caution. This exposes you to a security risk if you do not know what you are doing.

These settings will apply to all extensions, and not just Dark Reader.

Step 1: change Dark Reader's settings.

  • Click on the Dark Reader icon.
  • Click on the Dev tools button (in the bottom-right corner).
  • Click on the Preview new design button.
  • Enable the Enable on restricted pages setting under Settings -> Advanced.

Step 2: change Firefox's settings.

  • Type about:config in the address bar and press Enter. A warning page may appear. Click Accept the Risk and Continue to proceed.
  • Search for and set extensions.webextensions.restrictedDomains to an empty value.
  • Create extensions.webextensions.addons-restricted-domains@mozilla.com.disabled with boolean as type and set its value to true.
  • Set privacy.resistFingerprinting.block_mozAddonManager to true.
  • Restart Firefox.

Contributors


Thank you to all our contributors! Dark Reader exists thanks to you.



Backers


Thank you to all our generous backers! Support Dark Reader by becoming a backer.



Sponsors

Does your company use Dark Reader? Please ask your manager or the marketing team if your company would be interested in supporting our project. Your support will allow the maintainers to dedicate more time to maintenance and creating new features for everyone. Also, your company's logo will show on GitHub. Who doesn't want a little extra exposure? Here's the info.

Thank you to all our wonderful sponsors!



darkreader's People

Contributors

alexalekseyenko avatar alexanderby avatar andrew-j-larson avatar banonotit avatar bershanskiy avatar c-nagy avatar dependabot[bot] avatar elaborendum avatar fademind avatar felixonmars avatar gitoffthelawn avatar grelo4ka avatar gusted avatar jemsurfer avatar linsui avatar merajmasuk avatar mertyn avatar mukundan314 avatar myshor avatar myzel394 avatar omarnamis avatar paniash avatar pnaf avatar qtlunya avatar rakleed avatar sprinkledcheese avatar tiagoquix avatar vulcansphere avatar xxyzz avatar yash-singh1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

darkreader's Issues

Feature request: separate black/white lists

Hi,
I love this extension and I have a proposal for improvement.
Today, there's only one list of sites which acts as 'inverted list' or 'no touch list' depending on the mode.
This doesn't make much sense because the sites that are chosen to be inverted should always be inverted, not depending on the default mode. And vice versa.
The suggestion is: there should be two separate lists for sites to be inverted and for sites to stay untouched. And the 'default' mode will do the default to the sites that are not in any of the lists.

Time settings

I recently switched to Dark Reader because I've found that it's generally better about inverting the colors consistently.

One feature I miss from the extension I had been using (Night Reading Mode) was the ability to have dark mode "On", "Off", or "Auto", the last of which would turn dark mode on during a range of times (i.e., at night). It also let you override the above setting per-domain.

As an example, you could have it Night Reading Mode to "Auto" (so it'd become dark from maybe 7:00 p.m. to 7:00 a.m.), but have something like hslpicker.com be always regardless "Off".

Text rendering issues

The text isn't rendered properly IMHO - somehow it's not looking clean and is difficult to read. I even see it on your screenshots. There is a noticeable difference between the font on pages that are designed to be dark and the view created by this extension. It feels like the "text stroke" option is never really disabled even when it tells that it's switched off.

Anyways - this is a very cool and useful extension I've been waiting for. A big thank your for sharing it!

UPDATE:
I just found an easy work around:

html {
    text-shadow: 0 0 0 rgba(0,0,0,0.5);
}

This is also being inverted so the result is higher text contrast - the bitten out parts are being smoothed ;)

QR Codes should not be inverted

Hi guys
I wanted to connect my iPhone to web.whatsapp.com, therefore I had to scan a QR Code with my iPhone. As dark reader also inverted the QR Code, my iPhone was not able to scan it. I needed some time until I understood that it was because of dark reader.

This issue is very low priority, but perhaps there is a way to detect whether an image is a QR Code?
In the case with whatsapp.com the image lies in a <div> called "qrcode".

It really is no big deal, as you can manually turn off dark reader for whatsapp.com. It just annoyed me for several days until I got the issue...

Subdomains inherit toggle status from parent

So I realize that this behavior is by design, but it took me a while to figure out what was happening, so I thought I'd drop an issue here to see what other people thought.

I often run into an issue where I am working on a development version of my own site and all of a sudden I'm not able to toggle it on and off. I finally realized what the issue was.

Lets say I'm developing a site where production is example.com and development is at dev.example.com. I'm not only constantly switching between the two during development, but I'm toggling dark reader off and on for both in order to check CSS and other design aspects.

If I toggle dark reader off in production ( example.com ), then development ( dev.example.com ) will follow that setting and will no longer be togglable. This is because example.com is added to the "not inverted site list" and applies to all subdomains automatically. When I toggle dev.example.com, it is added and removed from the "not inverted site list", but because example.com overrides it, the toggle has no effect.

Perhaps adding a list of sites that have to match the full domain exactly in order for the toggle to apply?

PDF Reader looks weird

Hi,

In night mode, Chrome' PDF reader looks very strange as borders are really clear with a darker part for the PDF itself.

It would be better if background and top bar had darker grey in night mode.

capture

Invert IFrames

Hi Alexender,

Thank you for this great extension :).

My issue is, that I would like to read a site in dark, where are sub-pages are loaded on the fly to several iframes. As the content is loaded, it won't be inverted, but stays in light colours.

If I load the sub-pages standalone, they rendered in dark, correctly.
Is this a bug or feature, and is there anything I can do about this?

regards,
Gabor

Tests

At least JSON configs and correct CSS creation should be checked.

contrast/brightness settings should not apply to images

Hello,

First off thanks for the great chrome extension :)

Some people might disagree with me, but I would prefer if images were not affected by the Dark Reader contrast/brightness settings. The reason is that I want to turn down the brightness of text and backgrounds, but still have the original images on the pages I am reading.

If not a default setting, maybe there could be an option for it?

[Performance] Scrolling gets sluggish on certain websites

On highly dynamic sites with lots of images like plus.google.com or pinterest.com, the performance degrades significantly and scrolling makes the page stutter visually.

Currently using Ubuntu 14.04 x64 LTS with the latest version of chromium from the repository

Chromium    43.0.2357.81 (Developer Build) Ubuntu 14.04 (64-bit)
Revision    4d096306deb9e86953c81f08454dd6db07b406b5
OS  Linux 
Blink   537.36 (@195776)
JavaScript  V8 4.3.61.23
Flash   14.0.0.177
User Agent  Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.81 Chrome/43.0.2357.81 Safari/537.36
Command Line    /usr/lib/chromium-browser/chromium-browser --password-store=gnome --ppapi-flash-path=/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so --ppapi-flash-version=14.0.0.177 --enable-pinch --flag-switches-begin --disallow-autofill-sync-credential --disable-device-discovery-notifications --no-pings --disable-account-consistency --disable-affiliation-based-matching --enable-devtools-experiments --enable-drop-sync-credential --enable-fast-unload --disable-password-generation --disable-password-link --disable-sync-app-list --enhanced-bookmarks-experiment=0 --save-page-as-mhtml --flag-switches-end
Executable Path /usr/lib/chromium-browser/chromium-browser

Google Hangouts website inverted emjois

I apologize if this is not the correct method of submitting this kind of issue, but it seems that there's a bit of a glitch on the Google Hangouts website when it comes to emojis.

When on the website (hangouts.google.com) with the dark mode extension enabled, emojis shown while the chat window is popped in show up properly:

screen shot 2016-06-09 at 9 04 23 pm

Unfortunately, when you pop the chat into it's own window, the extension inverts the color of the emojis, resulting in this:

screen shot 2016-06-09 at 9 04 47 pm

Is this something that can be fixed? Perhaps it's possible to prevent emoji images from inverting at all on the Hangouts website? Thanks for the help.

Element Picker for Per-Site Exclusion Rules

Hi, just discovered Dark Reader, and it's great. I didn't see this in the issues, but I'd be interested seeing what the interest/feelings are on support for more extensive per-site customization/overrides.

Ideally, it'd be nice to be able to adjust some of the rules (like contrast) on a per-site level, and on a per-element basis (using an element picker) - is anyone using Dark Reader w/ Stylish? Maybe there's easy ways to carve out exclusions that way.

Otherwise I'd be interesting in forking and doing some work on a version that has some of this functionality, maybe also making the ignore/darksites JSON file be something that could auto-update/be customized - I see some pull requests there? Just wanted to see what you think before I get started @alexanderby

What's the darkreader license btw? There are some plugins that already have some functionality, but uBlock for example is GPLv3, and there might be other code that'd be useful that's MIT licensed.

On current Dev and Canary builds (Chrome 45), the background is not inverted

I wanted to pass along that this extension is also affected by Chromium issue 501582, which prevents CSS filters applied to the root element from affecting the page background.

This is a demonstration of the issue with today's Canary build 45.0.2435.0:
screen shot 2015-06-18 at 8 32 15 am

I hope they acknowledge this as incorrect behavior and fix it before this change flows into the Beta or Stable channels, but it might be prudent to look into workarounds like overriding the background.

Per-computer enable/disable

I have one computer in a dark room and another in a bright room. It would be nice if there was an option of enabling Dark Reader on only one of them, even when they use the same Chrome account.

Feature request: gamma correction for LCD monitors

Hi,
I'm not quite sure this is possible to do but I have to ask.

My problem is: on some sites I can't see light yellow highlighted text while inverted.
Turns out that LCD monitors are known to use gamma correction (some info can be found here http://www.eizoglobal.com/library/basics/lcd_display_gamma/ )
What it means to me: as you can see, less difference in light range (on the right) lead to more difference than the same numeric difference in dark range (on the left).

Hence, the proper way to invert an image would be:

  1. Un-gamma = apply (1/gamma)
  2. Invert
  3. Apply gamma

This could be an additional filter and gamma value slider.

I work a lot with code, this would be extremely useful.

svg images on wikipedia

When viewing wikipedia articles svg images in them are unreadable, as the background is inverted but the rest of the image is not. Not sure if it applies to other sites too.

On meetup.com, the images get inverted as well

If you head over to http://www.meetup.com/ , the images get inverted as well and not just the page. There should be a global rule to disallow inverting of any images.

Currently using Ubuntu 14.04 x64 LTS with the latest version of chromium from the repository

Chromium    43.0.2357.81 (Developer Build) Ubuntu 14.04 (64-bit)
Revision    4d096306deb9e86953c81f08454dd6db07b406b5
OS  Linux 
Blink   537.36 (@195776)
JavaScript  V8 4.3.61.23
Flash   14.0.0.177
User Agent  Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.81 Chrome/43.0.2357.81 Safari/537.36
Command Line    /usr/lib/chromium-browser/chromium-browser --password-store=gnome --ppapi-flash-path=/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so --ppapi-flash-version=14.0.0.177 --enable-pinch --flag-switches-begin --disallow-autofill-sync-credential --disable-device-discovery-notifications --no-pings --disable-account-consistency --disable-affiliation-based-matching --enable-devtools-experiments --enable-drop-sync-credential --enable-fast-unload --disable-password-generation --disable-password-link --disable-sync-app-list --enhanced-bookmarks-experiment=0 --save-page-as-mhtml --flag-switches-end
Executable Path /usr/lib/chromium-browser/chromium-browser

Question: Export CSS?

Hey awesome extension. Just a question though.

Is there any way to export or view the CSS that is created when running the extension? Thanks! :)

What is the license of this repository?

I want to practice programming with Javascript and modify some code in this project (educational purpose), but I don't know what the license is. I think this repository needs a license.

Sometimes DarkReader fails to inject its <style>

I noticed that occasionally some sited stay not inverted.
Examined the DOM I found out that DarkReader's <style id="dark-reader-style" ... is not there.
Adding-removing the site from the exclusion list doesn't help.
Sometimes the page gets inverted when reloaded.

One site the most often suffer from this is docs.google.com.

Color edition

I have been using the extension for a while and I realized that it's really troublesome to pick up a color because all of the colors are inverted, and the text I am writing it inherits them.

I have no idea on how I would solve this, but at least I will fill this issue.

A simple color edition place is atlassian.

Demo place https://demo.stiltsoft.com/pages/createpage.action?spaceKey=CIPE

Infinite scroll issue

I got a question about Dark Reader.

I have a MacBook Pro with OS X El Capitan‎. I noticed that when I go into gmail.com, I cannot scroll down with my mouse or trackpad while having darkreader enabled. The only way I can scroll down is by dragging the scrollbar with the mouse.

Would you know what may cause that issue?

Thank you so much!

Enable Dark Reader on New Tab pages

A possible new feature for Dark Reader would be to function on New Tab pages, using whatever algorithm it normally uses to darken pages on the New Tab page. I'm not sure how possible this is, and it may conflict with themes that the user has installed, but if it can be done it would really improve the experience of using the extension.

background img inverted...Need Help!

I have tried changing sites_fixes_v2.json
{
"url": "blog.naver.com",
"selectors": ".se_mediaImage, .__se_img_el"
},

but it doesn't work for the sub directorties such as

blog.naver.com/abcd
blog.naver.com/123

I'm wondering how I can fix this?

Ignore images

This is more of a feature request. It'd be great if the extension had an option to ignore images.

[bug] Some sites have blurred fonts when in dark mode

I have had a somewhat odd issue. On some sites (specifically the stackexchange.com site) I have noticed that the text is often blurred or fuzzy when dark reader is on, but is clear and sharp when turned off.

It is very strange because it only affects some pages of stackexchange and not others. For example, this page:

http://serverfault.com/questions/162018/force-ssh-to-use-a-specific-shell

Shows up blurry for me when dark reader is on. Here are some screenshots of the difference on my monitor:

Fuzzy Dark Reader page

Crisp Standard page (Darkreader was turned off for this screenshot)

However, other pages from the same website don't have this issue. For example: http://serverfault.com/questions/811736/i-accidentally-deleted-var-log-syslog-now-rsyslog-wont-log-anything

I am currently running:

OS: Windows 10
Browser: Google Chrome 55.0.2883.21 beta (64-bit)
Darkreader: 3.4.3

Amazon.com search textbox is black on black

Text in searchbox of Amazon.com is unreadable because it is black text on a black searchbox. Text becomes white sometimes after clicking the textbox, but never while editing the text.

Storing Site specific custom settings

This feature request may be a bit demanding. But could you store those site specific customization in the extension locally, so that we don't need to change it every time?

e.g. Even for the dark theme, I may prefer a contrast with -30% for one particular site, while other sites remain at -10%.

uBlock Origin has this kind of site specific customerization. You may take a look at its source code:
https://github.com/uBlockOrigin/uAssets

Feature Request: Site Specific Dark Skin

For example specific Skin for most commonly used websites by Extension User.
1.Facebook
2.Google
3.Wikipedia
4.Travel Sites such as Tripadvisor
5. News Sites (Mashable, Verge, TC etc)
6. Youtube
7. Dev Sites (stackexchange, product hunt)

and many more. I guess there wont be more than 100 sites which we can skin.

Iconic font break on change font feature

I like the feature that we can change website fonts, for better reading...
But, there are a bug that happen on sites that use iconic fonts such as: Font awesome, Bootstrap glyphicon, etc ... Because of, the fonts in the list does not support that kind of font (iconic).

So, I have an idea for that. Instead of replace font-family attribute for all elements, you should prepend that font to the current font-family attribute.

Example: http://getbootstrap.com/components/
Instead of

* {
     font-family: Avenir !important;
}

We should have this

* {
     font-family: Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif, anchorjs-icons, "Glyphicons Halflings", Menlo, Monaco, Consolas, "Courier New", monospace, Arial, Helvetica, "Open Sans", sans-serif !important;
}

I'm using this snippet http://stackoverflow.com/a/35022690 to collect fonts that used in that page.

Hope this will be fixed, thanks !

Auto Toggle based on Sunrise/Sunset given by Zip Code

Similar to how f.lux and iOS's Night Shift operates, it would be great if Dark Reader automatically was on during the day and off at night.
Currently, I do this manually, so this implementation would really save me time. Thanks!

Vivaldi hotkey issue

Works great when I use this extension in the Vivaldi browser, but the hotkeys doesn't work.

I've tried to set the same hotkeys in Chrome and then they work just fine.

Probably not a very high priority to fix, rare browser and its not really broken, but might be good to know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.