UNPKG

8.56 kBMarkdownView Raw
1<p align="center"><a href="https://darkreader.org" target="_blank" rel="noreferrer noopener"><img width="250" alt="Dark Reader's mascot" src="https://raw.githubusercontent.com/darkreader/darkreader.github.io/master/images/darkreader-mascot.svg"></a></p>
2<p align="center">Dark Reader <strong>analyzes</strong> web pages and aims to <strong>reduce eyestrain</strong> while browsing the web.</p>
3<br/>
4<p align="center"><a rel="noreferrer noopener" href="https://chrome.google.com/webstore/detail/dark-reader/eimadpbcbfnmbkopoojfekhnkhdbieeh/"><img alt="Chrome Web Store" src="https://img.shields.io/badge/Chrome-141e24.svg?&style=for-the-badge&logo=google-chrome&logoColor=white"></a> <a rel="noreferrer noopener" href="https://addons.mozilla.org/firefox/addon/darkreader/"><img alt="Firefox Add-ons" src="https://img.shields.io/badge/Firefox-141e24.svg?&style=for-the-badge&logo=firefox-browser&logoColor=white"></a> <a rel="noreferrer noopener" href="https://darkreader.org/safari/"><img alt="Apple App Store" src="https://img.shields.io/badge/Safari-141e24.svg?&style=for-the-badge&logo=safari&logoColor=white"></a> <a rel="noreferrer noopener" href="https://microsoftedge.microsoft.com/addons/detail/dark-reader/ifoakfbpdcdoeenechcleahebpibofpc/"><img alt="Edge Addons" src="https://img.shields.io/badge/Edge-141e24.svg?&style=for-the-badge&logo=microsoft-edge&logoColor=white"></a> <a el="noreferrer noopener" href="https://addons.thunderbird.net/thunderbird/addon/darkreader"><img alt="Thunderbird" src="https://img.shields.io/badge/Thunderbird-141e24.svg?&style=for-the-badge&logo=thunderbird&logoColor=white"></a>
5
6<h2 align="center">Dark Reader</h2>
7<br/>
8<p align="center">Dark Reader is an <strong>open-source</strong> MIT-licensed <strong>browser extension</strong> designed to analyze web pages. Dark Reader will generate a dark mode that aims to <strong>reduce the eyestrain</strong> of the user. Dark Reader is <strong>feature-rich</strong> and is customizable in many ways throughout the UI.</p>
9<br/>
10<br/>
11
12## Questions
13
14Most questions can be answered by reading the [help page](https://darkreader.org/help/).
15If the help page doesn't answer your question, open up a new [discussion](https://github.com/darkreader/darkreader/discussions).
16
17## How to contribute
18
19Read more about contributing to Dark Reader in [CONTRIBUTING.md](https://github.com/darkreader/darkreader/blob/master/CONTRIBUTING.md).
20
21## Building for use
22
23You can install the extension from a file.
24Install [Node.js LTS](https://nodejs.org/en/). Download the source code (or check out from git).
25Open the terminal in the root folder and run:
26
27- `npm install`
28- `npm run build`
29
30This 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.
31
32## Using Dark Reader for a website
33
34You can use Dark Reader to enable dark mode on your website!
35
36- Install the package from NPM (`npm install darkreader`)
37- or build from the source code (`npm run api`)
38- or include the script via a CDN such as [unpkg](https://unpkg.com/darkreader/) or [jsDelivr](https://www.jsdelivr.com/package/npm/darkreader)
39
40Then you can use the following code to control Dark Reader's API
41```javascript
42DarkReader.enable({
43 brightness: 100,
44 contrast: 90,
45 sepia: 10
46});
47
48DarkReader.disable();
49
50// Enable when the system color scheme is dark.
51DarkReader.auto({
52 brightness: 100,
53 contrast: 90,
54 sepia: 10
55});
56
57// Stop watching for the system color scheme.
58DarkReader.auto(false);
59
60// Get the generated CSS of Dark Reader returned as a string.
61const CSS = await DarkReader.exportGeneratedCSS();
62
63// Check if Dark Reader is enabled.
64const isEnabled = DarkReader.isEnabled();
65```
66
67... or if you are using ES modules
68
69```javascript
70import {
71 enable as enableDarkMode,
72 disable as disableDarkMode,
73 auto as followSystemColorScheme,
74 exportGeneratedCSS as collectCSS,
75 isEnabled as isDarkReaderEnabled
76} from 'darkreader';
77
78enableDarkMode({
79 brightness: 100,
80 contrast: 90,
81 sepia: 10,
82});
83
84disableDarkMode();
85
86followSystemColorScheme();
87
88const CSS = await collectCSS();
89
90const isEnabled = isDarkReaderEnabled();
91```
92
93Be aware that darkreader 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.
94
95## Site fixes
96
97Automatically 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.
98
99However, this can be enabled using the following steps:
100
101- Click on the Dark Reader icon.
102- Click on the Dev tools button (in the bottom-right corner).
103- Click on the Preview new design button.
104- Enable the `Synchronize site fixes` setting under `Settings -> Manage Settings`.
105
106<h2 align="center">Contributors</h2>
107<br/>
108<h3 align="center"><strong>Thank you to all our contributors! Dark Reader exists thanks to you.</strong></h3>
109<br/>
110<br/>
111<p align="center"><a rel="noreferrer noopener" href="https://github.com/darkreader/darkreader/graphs/contributors/"><img src="https://opencollective.com/darkreader/contributors.svg?width=890&button=false"/></a></p>
112
113<h2 align="center">Backers</h2>
114<br/>
115<h3 align="center"><strong>Thank you to all our generous backers! </strong>Support Dark Reader by <a rel="noreferrer noopener" href="https://opencollective.com/darkreader" target="_blank">becoming a backer</a>.</h3>
116<br/>
117<br/>
118<p align="center"><a rel="noreferrer noopener" href="https://opencollective.com/darkreader#backers" target="_blank"><img src="https://opencollective.com/darkreader/backers.svg?width=890&limit=1000"></a></p>
119
120<h2 align="center">Sponsors</h2>
121<p>Does your company use Dark Reader? 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 <a rel="noreferrer noopener" href="https://github.com/darkreader/darkreader#sponsors" target="_blank">GitHub</a>. Who doesn't want a little extra exposure? <a rel="noreferrer noopener" href="https://opencollective.com/darkreader" target="_blank">Here's the info</a>.</p>
122
123<h3 align="center"><strong>Thank you to all our wonderful sponsors!</strong></h3>
124<br/>
125<br/>
126<a href="https://opencollective.com/darkreader/sponsor/0/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/0/avatar.svg"></a>
127<a href="https://opencollective.com/darkreader/sponsor/1/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/1/avatar.svg"></a>
128<a href="https://opencollective.com/darkreader/sponsor/2/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/2/avatar.svg"></a>
129<a href="https://opencollective.com/darkreader/sponsor/3/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/3/avatar.svg"></a>
130<a href="https://opencollective.com/darkreader/sponsor/4/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/4/avatar.svg"></a>
131<a href="https://opencollective.com/darkreader/sponsor/5/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/5/avatar.svg"></a>
132<a href="https://opencollective.com/darkreader/sponsor/6/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/6/avatar.svg"></a>
133<a href="https://opencollective.com/darkreader/sponsor/7/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/7/avatar.svg"></a>
134<a href="https://opencollective.com/darkreader/sponsor/8/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/8/avatar.svg"></a>
135<a href="https://opencollective.com/darkreader/sponsor/9/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/9/avatar.svg"></a>
136<a href="https://opencollective.com/darkreader/sponsor/10/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/10/avatar.svg"></a>