darkreader 4.9.89 → 4.9.92

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.
Files changed (2) hide show
  1. package/darkreader.js +30 -57
  2. package/package.json +2 -1
package/darkreader.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Dark Reader v4.9.89
2
+ * Dark Reader v4.9.92
3
3
  * https://darkreader.org/
4
4
  */
5
5
 
@@ -355,20 +355,35 @@
355
355
  darkSchemeTextColor: DEFAULT_COLORS.darkScheme.text,
356
356
  lightSchemeBackgroundColor: DEFAULT_COLORS.lightScheme.background,
357
357
  lightSchemeTextColor: DEFAULT_COLORS.lightScheme.text,
358
- scrollbarColor: isMacOS ? "" : "auto",
358
+ scrollbarColor: "",
359
359
  selectionColor: "auto",
360
360
  styleSystemControls: !isCSSColorSchemePropSupported,
361
361
  lightColorScheme: "Default",
362
362
  darkColorScheme: "Default",
363
363
  immediateModify: false
364
364
  };
365
+ const filterModeSites = [
366
+ "*.officeapps.live.com",
367
+ "*.sharepoint.com",
368
+ "docs.google.com",
369
+ "onedrive.live.com"
370
+ ];
365
371
  ({
366
372
  schemeVersion: 0,
367
373
  enabled: true,
368
374
  fetchNews: true,
369
375
  theme: DEFAULT_THEME,
370
376
  presets: [],
371
- customThemes: [],
377
+ customThemes: filterModeSites.map((url) => {
378
+ const engine = isChromium
379
+ ? ThemeEngine.svgFilter
380
+ : ThemeEngine.cssFilter;
381
+ return {
382
+ url: [url],
383
+ theme: {...DEFAULT_THEME, engine},
384
+ builtIn: true
385
+ };
386
+ }),
372
387
  enabledByDefault: true,
373
388
  enabledFor: [],
374
389
  disabledFor: [],
@@ -393,7 +408,7 @@
393
408
  enableForPDF: true,
394
409
  enableForProtectedPages: false,
395
410
  enableContextMenus: false,
396
- detectDarkTheme: false
411
+ detectDarkTheme: true
397
412
  });
398
413
 
399
414
  function isArrayLike(items) {
@@ -2733,7 +2748,7 @@
2733
2748
  lines.push(` color-scheme: dark !important;`);
2734
2749
  lines.push("}");
2735
2750
  lines.push("iframe {");
2736
- lines.push(` color-scheme: initial;`);
2751
+ lines.push(` color-scheme: dark !important;`);
2737
2752
  lines.push("}");
2738
2753
  }
2739
2754
  const bgSelectors = joinSelectors(
@@ -2841,70 +2856,26 @@
2841
2856
  return lines.join("\n");
2842
2857
  }
2843
2858
  function getModifiedScrollbarStyle(theme) {
2844
- const lines = [];
2845
2859
  let colorTrack;
2846
- let colorIcons;
2847
2860
  let colorThumb;
2848
- let colorThumbHover;
2849
- let colorThumbActive;
2850
- let colorCorner;
2851
2861
  if (theme.scrollbarColor === "auto") {
2852
2862
  colorTrack = modifyBackgroundColor({r: 241, g: 241, b: 241}, theme);
2853
- colorIcons = modifyForegroundColor({r: 96, g: 96, b: 96}, theme);
2854
2863
  colorThumb = modifyBackgroundColor({r: 176, g: 176, b: 176}, theme);
2855
- colorThumbHover = modifyBackgroundColor(
2856
- {r: 144, g: 144, b: 144},
2857
- theme
2858
- );
2859
- colorThumbActive = modifyBackgroundColor(
2860
- {r: 96, g: 96, b: 96},
2861
- theme
2862
- );
2863
- colorCorner = modifyBackgroundColor(
2864
- {r: 255, g: 255, b: 255},
2865
- theme
2866
- );
2867
2864
  } else {
2868
2865
  const rgb = parseColorWithCache(theme.scrollbarColor);
2869
2866
  const hsl = rgbToHSL(rgb);
2870
- const isLight = hsl.l > 0.5;
2871
- const lighten = (lighter) => ({
2872
- ...hsl,
2873
- l: clamp(hsl.l + lighter, 0, 1)
2874
- });
2875
2867
  const darken = (darker) => ({
2876
2868
  ...hsl,
2877
2869
  l: clamp(hsl.l - darker, 0, 1)
2878
2870
  });
2879
2871
  colorTrack = hslToString(darken(0.4));
2880
- colorIcons = hslToString(isLight ? darken(0.4) : lighten(0.4));
2881
2872
  colorThumb = hslToString(hsl);
2882
- colorThumbHover = hslToString(lighten(0.1));
2883
- colorThumbActive = hslToString(lighten(0.2));
2884
- colorCorner = hslToString(darken(0.5));
2885
2873
  }
2886
- lines.push("::-webkit-scrollbar {");
2887
- lines.push(` background-color: ${colorTrack};`);
2888
- lines.push(` color: ${colorIcons};`);
2889
- lines.push("}");
2890
- lines.push("::-webkit-scrollbar-thumb {");
2891
- lines.push(` background-color: ${colorThumb};`);
2892
- lines.push("}");
2893
- lines.push("::-webkit-scrollbar-thumb:hover {");
2894
- lines.push(` background-color: ${colorThumbHover};`);
2895
- lines.push("}");
2896
- lines.push("::-webkit-scrollbar-thumb:active {");
2897
- lines.push(` background-color: ${colorThumbActive};`);
2898
- lines.push("}");
2899
- lines.push("::-webkit-scrollbar-corner {");
2900
- lines.push(` background-color: ${colorCorner};`);
2901
- lines.push("}");
2902
- if (isFirefox) {
2903
- lines.push("* {");
2904
- lines.push(` scrollbar-color: ${colorThumb} ${colorTrack};`);
2905
- lines.push("}");
2906
- }
2907
- return lines.join("\n");
2874
+ return [
2875
+ `* {`,
2876
+ ` scrollbar-color: ${colorThumb} ${colorTrack};`,
2877
+ `}`
2878
+ ].join("\n");
2908
2879
  }
2909
2880
  function getModifiedFallbackStyle(theme, {strict}) {
2910
2881
  const factory = defaultFallbackFactory;
@@ -6882,7 +6853,9 @@
6882
6853
  document.head.appendChild(overrideStyle);
6883
6854
  setupNodePositionWatcher(overrideStyle, "override");
6884
6855
  const variableStyle = createOrUpdateStyle("darkreader--variables");
6885
- const selectionColors = getSelectionColor(theme);
6856
+ const selectionColors = theme?.selectionColor
6857
+ ? getSelectionColor(theme)
6858
+ : null;
6886
6859
  const neutralBackgroundColor = modifyBackgroundColor(
6887
6860
  parseColorWithCache("#ffffff"),
6888
6861
  theme
@@ -6895,8 +6868,8 @@
6895
6868
  `:root {`,
6896
6869
  ` --darkreader-neutral-background: ${neutralBackgroundColor};`,
6897
6870
  ` --darkreader-neutral-text: ${neutralTextColor};`,
6898
- ` --darkreader-selection-background: ${selectionColors.backgroundColorSelection};`,
6899
- ` --darkreader-selection-text: ${selectionColors.foregroundColorSelection};`,
6871
+ ` --darkreader-selection-background: ${selectionColors?.backgroundColorSelection ?? "initial"};`,
6872
+ ` --darkreader-selection-text: ${selectionColors?.foregroundColorSelection ?? "initial"};`,
6900
6873
  `}`
6901
6874
  ].join("\n");
6902
6875
  document.head.insertBefore(variableStyle, inlineStyle.nextSibling);
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "darkreader",
3
- "version": "4.9.89",
3
+ "version": "4.9.92",
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:firefox": "node --max-old-space-size=3072 tasks/cli.js build --release --firefox",
9
10
  "build:plus": "node --max-old-space-size=3072 tasks/cli.js build --plus --release",
10
11
  "code-style": "npm run lint",
11
12
  "debug": "node --max-old-space-size=3072 tasks/cli.js build --debug",