darkreader 4.9.87 → 4.9.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -22
- package/darkreader.js +18 -32
- package/package.json +21 -16
package/README.md
CHANGED
|
@@ -50,9 +50,9 @@ Dark Reader repository contains these digital signatures and you can add them to
|
|
|
50
50
|
npm run build -- --firefox --version=4.9.63
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Please note that only Firefox Add-ons store signatures are present in the
|
|
53
|
+
Please note that only Firefox Add-ons store signatures are present in the repository 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).
|
|
54
54
|
|
|
55
|
-
## Using Dark Reader
|
|
55
|
+
## Using Dark Reader on a website
|
|
56
56
|
|
|
57
57
|
You can use Dark Reader to enable dark mode on your website!
|
|
58
58
|
|
|
@@ -117,46 +117,76 @@ Be aware that Dark Reader will add the `chrome` object onto the `window` object.
|
|
|
117
117
|
|
|
118
118
|
## Site fixes
|
|
119
119
|
|
|
120
|
-
Automatically syncing the site fixes
|
|
120
|
+
Automatically syncing the site fixes for every Dark Reader user was disabled because the GitHub team does not allow using GitHub as a content delivery network (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 the new changes.
|
|
121
121
|
|
|
122
|
-
However, this can be enabled
|
|
122
|
+
However, this can be manually enabled with the following steps:
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
1. Click on the Dark Reader extension icon.
|
|
125
|
+
2. Click on the `Dev tools` button (in the bottom-right corner).
|
|
126
|
+
3. Go to `Advanced` and click on the `Preview new design` button.
|
|
127
|
+
4. Close the developer tools window and click on the Dark Reader extension icon again.
|
|
128
|
+
5. Go to `Settings` -> `Advanced` and enable the `Synchronize sites fixes` setting.
|
|
128
129
|
|
|
129
130
|
To force a synchronization of the sites fixes (when the corresponding setting is enabled), perform the following steps:
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
1. Click on the Dark Reader extension icon.
|
|
133
|
+
2. Go to `Settings` -> `Advanced` -> `Dev tools`.
|
|
134
|
+
3. For each "Editor" section, click on `Reset changes`, confirm with `OK`, and then click on `Apply`. Afterwards, close the developer tools window and reload the desired page(s).
|
|
134
135
|
|
|
135
|
-
## Enable Dark Reader
|
|
136
|
+
## Enable Dark Reader on restricted pages on Mozilla Firefox
|
|
136
137
|
|
|
137
138
|
By default, Dark Reader does not work on some websites due to **security restrictions** enforced by Mozilla.
|
|
138
139
|
|
|
139
|
-
The following instructions will guide you on how to
|
|
140
|
+
The following instructions will guide you on how to disable those restrictions.
|
|
140
141
|
|
|
141
142
|
**Proceed with caution. This exposes you to a security risk if you do not know what you are doing.**
|
|
142
143
|
|
|
144
|
+
**Be sure that you do not have any suspicious or malicious-looking extension installed before proceeding.**
|
|
145
|
+
|
|
143
146
|
**These settings will apply to all extensions, and not just Dark Reader.**
|
|
144
147
|
|
|
145
148
|
Step 1: change Dark Reader's settings.
|
|
146
149
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
1. Click on the Dark Reader extension icon.
|
|
151
|
+
2. Click on the `Dev tools` button (in the bottom-right corner).
|
|
152
|
+
3. Go to `Advanced` and click on the `Preview new design` button.
|
|
153
|
+
4. Close the developer tools window and click on the Dark Reader extension icon again.
|
|
154
|
+
5. Go to `Settings` -> `Advanced` and enable the `Enable on restricted pages` setting.
|
|
151
155
|
|
|
152
156
|
Step 2: change Firefox's settings.
|
|
153
157
|
|
|
154
158
|
- Type `about:config` in the address bar and press Enter.
|
|
155
|
-
A warning page may appear. Click `Accept the Risk and Continue` to proceed.
|
|
156
|
-
- Search for and set `extensions.webextensions.restrictedDomains` to an empty value.
|
|
157
|
-
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
- A warning page may appear. Click `Accept the Risk and Continue` to proceed.
|
|
160
|
+
- Search for and set `extensions.webextensions.restrictedDomains` to an empty value (if the preference does not exist, create with it `String` as the type).
|
|
161
|
+
- Set `privacy.resistFingerprinting.block_mozAddonManager` to `true` (if the preference does not exist, create with it `Boolean` as the type).
|
|
162
|
+
|
|
163
|
+
After changing the necessary settings for both Dark Reader and Firefox, reload the desired page(s).
|
|
164
|
+
|
|
165
|
+
**If you had previously changed any of the following preferences, please reset them to their default values as they are only related to security and are not necessary for Dark Reader to work on restricted websites.**
|
|
166
|
+
To reset them, click on the reset (or delete icon, if present) icon at the most-right corner of the preference line in `about:config`.
|
|
167
|
+
- `extensions.webextensions.addons-restricted-domains@mozilla.com.disabled`
|
|
168
|
+
- `extensions.quarantinedDomains.enabled`
|
|
169
|
+
- `extensions.quarantinedDomains.list`
|
|
170
|
+
|
|
171
|
+
### Clarification about quarantined domains ("Run on sites with restrictions" option)
|
|
172
|
+
<details><summary>Quarantined domains and Dark Reader — an explanation</summary>
|
|
173
|
+
|
|
174
|
+
The option "Run on sites with restrictions", present in some extensions, is only related to quarantined domains, and is not needed for Dark Reader to work on restricted websites.
|
|
175
|
+
|
|
176
|
+
More information about quarantined domains: [Why are some add-ons not allowed on sites restricted by Mozilla?](https://support.mozilla.org/en-US/kb/quarantined-domains)
|
|
177
|
+
|
|
178
|
+
For Dark Reader, the option is not shown because Dark Reader is a [Recommended](https://support.mozilla.org/en-US/kb/recommended-extensions-program) extension by Mozilla.
|
|
179
|
+
|
|
180
|
+
Due to it being a Recommended extension, it means it meets the "highest standards of security, functionality, and user experience". The quarantined domains are only related to security, and because Dark Reader is considered secure by Mozilla, that option is not shown, meaning **it will always run even on quarantined domains**.
|
|
181
|
+
|
|
182
|
+
[From Firefox's source code:](https://searchfox.org/mozilla-central/source/toolkit/components/extensions/Extension.sys.mjs#2937-2938)
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
// Privileged extensions and any extensions with a recommendation state are
|
|
186
|
+
// exempt from the quarantined domains.
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
</details>
|
|
160
190
|
|
|
161
191
|
<h2 align="center">Contributors</h2>
|
|
162
192
|
<br/>
|
package/darkreader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dark Reader v4.9.
|
|
2
|
+
* Dark Reader v4.9.89
|
|
3
3
|
* https://darkreader.org/
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -389,6 +389,7 @@
|
|
|
389
389
|
longitude: null
|
|
390
390
|
},
|
|
391
391
|
previewNewDesign: false,
|
|
392
|
+
previewNewestDesign: false,
|
|
392
393
|
enableForPDF: true,
|
|
393
394
|
enableForProtectedPages: false,
|
|
394
395
|
enableContextMenus: false,
|
|
@@ -1935,12 +1936,6 @@
|
|
|
1935
1936
|
fnCache.set(id, color);
|
|
1936
1937
|
return color;
|
|
1937
1938
|
}
|
|
1938
|
-
function noopHSL(hsl) {
|
|
1939
|
-
return hsl;
|
|
1940
|
-
}
|
|
1941
|
-
function modifyColor(rgb, theme) {
|
|
1942
|
-
return modifyColorWithCache(rgb, theme, noopHSL);
|
|
1943
|
-
}
|
|
1944
1939
|
function modifyLightSchemeColor(rgb, theme) {
|
|
1945
1940
|
const poleBg = getBgPole(theme);
|
|
1946
1941
|
const poleFg = getFgPole(theme);
|
|
@@ -2996,6 +2991,9 @@
|
|
|
2996
2991
|
isCancelled
|
|
2997
2992
|
) {
|
|
2998
2993
|
try {
|
|
2994
|
+
if (shouldIgnoreImage(rule.selectorText, ignoreImageSelectors)) {
|
|
2995
|
+
return value;
|
|
2996
|
+
}
|
|
2999
2997
|
const gradients = parseGradient(value);
|
|
3000
2998
|
const urls = getMatches(cssURLRegex, value);
|
|
3001
2999
|
if (urls.length === 0 && gradients.length === 0) {
|
|
@@ -3052,11 +3050,6 @@
|
|
|
3052
3050
|
};
|
|
3053
3051
|
};
|
|
3054
3052
|
const getURLModifier = (urlValue) => {
|
|
3055
|
-
if (
|
|
3056
|
-
shouldIgnoreImage(rule.selectorText, ignoreImageSelectors)
|
|
3057
|
-
) {
|
|
3058
|
-
return null;
|
|
3059
|
-
}
|
|
3060
3053
|
let url = getCSSURLValue(urlValue);
|
|
3061
3054
|
const isURLEmpty = url.length === 0;
|
|
3062
3055
|
const {parentStyleSheet} = rule;
|
|
@@ -4489,8 +4482,8 @@
|
|
|
4489
4482
|
}
|
|
4490
4483
|
const isSVGElement = element instanceof SVGElement;
|
|
4491
4484
|
const svg = isSVGElement
|
|
4492
|
-
? element.ownerSVGElement ??
|
|
4493
|
-
(element instanceof SVGSVGElement ? element : null)
|
|
4485
|
+
? (element.ownerSVGElement ??
|
|
4486
|
+
(element instanceof SVGSVGElement ? element : null))
|
|
4494
4487
|
: null;
|
|
4495
4488
|
if (isSVGElement && theme.mode === 1 && svg) {
|
|
4496
4489
|
if (svgInversionCache.has(svg)) {
|
|
@@ -6890,29 +6883,18 @@
|
|
|
6890
6883
|
setupNodePositionWatcher(overrideStyle, "override");
|
|
6891
6884
|
const variableStyle = createOrUpdateStyle("darkreader--variables");
|
|
6892
6885
|
const selectionColors = getSelectionColor(theme);
|
|
6893
|
-
const
|
|
6894
|
-
|
|
6895
|
-
darkSchemeTextColor,
|
|
6896
|
-
lightSchemeBackgroundColor,
|
|
6897
|
-
lightSchemeTextColor,
|
|
6898
|
-
mode
|
|
6899
|
-
} = theme;
|
|
6900
|
-
let schemeBackgroundColor =
|
|
6901
|
-
mode === 0 ? lightSchemeBackgroundColor : darkSchemeBackgroundColor;
|
|
6902
|
-
let schemeTextColor =
|
|
6903
|
-
mode === 0 ? lightSchemeTextColor : darkSchemeTextColor;
|
|
6904
|
-
schemeBackgroundColor = modifyBackgroundColor(
|
|
6905
|
-
parseColorWithCache(schemeBackgroundColor),
|
|
6886
|
+
const neutralBackgroundColor = modifyBackgroundColor(
|
|
6887
|
+
parseColorWithCache("#ffffff"),
|
|
6906
6888
|
theme
|
|
6907
6889
|
);
|
|
6908
|
-
|
|
6909
|
-
parseColorWithCache(
|
|
6890
|
+
const neutralTextColor = modifyForegroundColor(
|
|
6891
|
+
parseColorWithCache("#000000"),
|
|
6910
6892
|
theme
|
|
6911
6893
|
);
|
|
6912
6894
|
variableStyle.textContent = [
|
|
6913
6895
|
`:root {`,
|
|
6914
|
-
` --darkreader-neutral-background: ${
|
|
6915
|
-
` --darkreader-neutral-text: ${
|
|
6896
|
+
` --darkreader-neutral-background: ${neutralBackgroundColor};`,
|
|
6897
|
+
` --darkreader-neutral-text: ${neutralTextColor};`,
|
|
6916
6898
|
` --darkreader-selection-background: ${selectionColors.backgroundColorSelection};`,
|
|
6917
6899
|
` --darkreader-selection-text: ${selectionColors.foregroundColorSelection};`,
|
|
6918
6900
|
`}`
|
|
@@ -6999,7 +6981,11 @@
|
|
|
6999
6981
|
return $cssText.replace(/\${(.+?)}/g, (_, $color) => {
|
|
7000
6982
|
const color = parseColorWithCache($color);
|
|
7001
6983
|
if (color) {
|
|
7002
|
-
|
|
6984
|
+
const lightness = getSRGBLightness(color.r, color.g, color.b);
|
|
6985
|
+
if (lightness > 0.5) {
|
|
6986
|
+
return modifyBackgroundColor(color, theme);
|
|
6987
|
+
}
|
|
6988
|
+
return modifyForegroundColor(color, theme);
|
|
7003
6989
|
}
|
|
7004
6990
|
return $color;
|
|
7005
6991
|
});
|
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "darkreader",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.89",
|
|
4
4
|
"description": "Dark mode for every website",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"api": "node --max-old-space-size=3072 tasks/cli.js build --api",
|
|
7
7
|
"build": "node --max-old-space-size=3072 tasks/cli.js build --release",
|
|
8
8
|
"build:all": "node --max-old-space-size=3072 tasks/cli.js build --debug --release --api",
|
|
9
|
+
"build:plus": "node --max-old-space-size=3072 tasks/cli.js build --plus --release",
|
|
9
10
|
"code-style": "npm run lint",
|
|
10
11
|
"debug": "node --max-old-space-size=3072 tasks/cli.js build --debug",
|
|
11
12
|
"debug:watch": "node --max-old-space-size=3072 tasks/cli.js build --debug --watch --chrome --firefox",
|
|
12
13
|
"debug:watch:mv3": "node --max-old-space-size=3072 tasks/cli.js build --debug --watch --chrome-mv3",
|
|
14
|
+
"debug:watch:plus": "node --max-old-space-size=3072 tasks/cli.js build --debug --watch --plus --chrome",
|
|
13
15
|
"dependencies:upgrade": "node tasks/dependencies.js",
|
|
14
16
|
"lint": "eslint --ignore-pattern '!.eslint-plugin-local.js' -- 'src/**/*.ts' 'src/**/*.tsx' 'tasks/**/*.js' 'tests/[!coverage]**/*.js' 'tests/**/*.ts' '.eslintrc.js' 'index.d.ts'",
|
|
15
17
|
"lint:bundle": "(node ./tasks/check-exists.js ./build/debug/chrome || node tasks/build.js --debug --api --chrome) && eslint -- 'build/debug/chrome/**/*.js' 'darkreader.js'",
|
|
18
|
+
"plus-link": "cd src && ln -s ../../darkreader-plus plus",
|
|
16
19
|
"prepublishOnly": "npm test && npm run api",
|
|
17
20
|
"release": "npm test && npm run lint && node tasks/cli.js build --release",
|
|
18
21
|
"test": "npm run test:unit",
|
|
@@ -55,30 +58,33 @@
|
|
|
55
58
|
"type": "opencollective",
|
|
56
59
|
"url": "https://opencollective.com/darkreader/donate"
|
|
57
60
|
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"malevic": "0.20.2"
|
|
63
|
+
},
|
|
58
64
|
"devDependencies": {
|
|
59
65
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
60
66
|
"@rollup/plugin-replace": "5.0.7",
|
|
61
67
|
"@rollup/plugin-typescript": "11.1.6",
|
|
62
|
-
"@types/chrome": "0.0.
|
|
68
|
+
"@types/chrome": "0.0.269",
|
|
63
69
|
"@types/eslint": "8.56.10",
|
|
64
70
|
"@types/jasmine": "5.1.4",
|
|
65
71
|
"@types/jest": "29.5.12",
|
|
66
72
|
"@types/karma": "6.3.8",
|
|
67
73
|
"@types/karma-coverage": "2.0.3",
|
|
68
|
-
"@types/node": "
|
|
69
|
-
"@types/ws": "8.5.
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "7.
|
|
71
|
-
"@typescript-eslint/parser": "7.
|
|
74
|
+
"@types/node": "22.2.0",
|
|
75
|
+
"@types/ws": "8.5.12",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "7.16.0",
|
|
77
|
+
"@typescript-eslint/parser": "7.16.0",
|
|
72
78
|
"chokidar": "3.6.0",
|
|
73
79
|
"eslint": "8.57.0",
|
|
74
80
|
"eslint-plugin-compat": "5.0.0",
|
|
75
81
|
"eslint-plugin-import": "2.29.1",
|
|
76
82
|
"eslint-plugin-local": "4.2.2",
|
|
77
|
-
"globby": "14.0.
|
|
78
|
-
"jasmine-core": "5.
|
|
83
|
+
"globby": "14.0.2",
|
|
84
|
+
"jasmine-core": "5.2.0",
|
|
79
85
|
"jest": "29.7.0",
|
|
80
86
|
"jest-extended": "4.0.2",
|
|
81
|
-
"karma": "6.4.
|
|
87
|
+
"karma": "6.4.4",
|
|
82
88
|
"karma-chrome-launcher": "3.2.0",
|
|
83
89
|
"karma-coverage": "2.2.1",
|
|
84
90
|
"karma-firefox-launcher": "2.1.3",
|
|
@@ -87,16 +93,15 @@
|
|
|
87
93
|
"karma-safari-launcher": "1.0.0",
|
|
88
94
|
"karma-spec-reporter": "0.0.36",
|
|
89
95
|
"less": "4.2.0",
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"rollup": "4.18.0",
|
|
96
|
+
"prettier": "3.3.3",
|
|
97
|
+
"puppeteer-core": "23.0.2",
|
|
98
|
+
"rollup": "4.20.0",
|
|
94
99
|
"rollup-plugin-istanbul": "5.0.0",
|
|
95
|
-
"ts-jest": "29.
|
|
100
|
+
"ts-jest": "29.2.4",
|
|
96
101
|
"tslib": "2.6.3",
|
|
97
|
-
"typescript": "5.5.
|
|
102
|
+
"typescript": "5.5.4",
|
|
98
103
|
"web-ext": "8.2.0",
|
|
99
|
-
"ws": "8.
|
|
104
|
+
"ws": "8.18.0",
|
|
100
105
|
"yazl": "2.5.1"
|
|
101
106
|
}
|
|
102
107
|
}
|