1 | declare namespace DarkReader {
|
2 | /**
|
3 | * Enables dark mode for current web page.
|
4 | * @param theme Theme options.
|
5 | * @param fixes Fixes for the generated theme.
|
6 | */
|
7 | function enable(theme: Partial<Theme>, fixes?: DynamicThemeFix): void;
|
8 |
|
9 | /**
|
10 | * Disables dark mode for current web page.
|
11 | */
|
12 | function disable(): void;
|
13 |
|
14 | /**
|
15 | * Enables dark mode when system color scheme is dark.
|
16 | * @param theme Theme options.
|
17 | * @param fixes Fixes for the generated theme.
|
18 | */
|
19 | function auto(theme: Partial<Theme> | false, fixes?: DynamicThemeFix): void;
|
20 |
|
21 | /**
|
22 | * Stops watching for system color scheme.
|
23 | * @param isEnabled Boolean `false` value.
|
24 | */
|
25 | function auto(isEnabled: false): void;
|
26 |
|
27 | /**
|
28 | * Sets a function for making CORS requests.
|
29 | * @param fetch A fetch function.
|
30 | */
|
31 | function setFetchMethod(fetch: (url: string) => Promise<Response>): void;
|
32 |
|
33 | /**
|
34 | * Returns the generated CSS by Dark Reader as a string.
|
35 | */
|
36 | function exportGeneratedCSS(): Promise<string>;
|
37 |
|
38 | /**
|
39 | * Theme options.
|
40 | */
|
41 | interface Theme {
|
42 | /**
|
43 | * 1 - dark mode, 0 - dimmed mode.
|
44 | * Default 1.
|
45 | */
|
46 | mode: 0 | 1;
|
47 | /**
|
48 | * Brightness (0 - 100+).
|
49 | * Default 100.
|
50 | */
|
51 | brightness: number;
|
52 | /**
|
53 | * Contrast (0 - 100+).
|
54 | * Default 100.
|
55 | */
|
56 | contrast: number;
|
57 | /**
|
58 | * Grayscale (0 - 100).
|
59 | * Default 0.
|
60 | */
|
61 | grayscale: number;
|
62 | /**
|
63 | * Sepia (0 - 100).
|
64 | * Default 0.
|
65 | */
|
66 | sepia: number;
|
67 | /**
|
68 | * Specifies if custom font should be used.
|
69 | * Default false.
|
70 | */
|
71 | useFont: boolean;
|
72 | /**
|
73 | * Font family to use.
|
74 | */
|
75 | fontFamily: string;
|
76 | /**
|
77 | * Makes text look bolder (0 - 1px).
|
78 | * Default 0.
|
79 | */
|
80 | textStroke: number;
|
81 | /**
|
82 | * Background color to use for dark mode.
|
83 | * Default #181a1b
|
84 | */
|
85 | darkSchemeBackgroundColor: string;
|
86 | /**
|
87 | * Text color to use for dark mode.
|
88 | * Default #e8e6e3
|
89 | */
|
90 | darkSchemeTextColor: string;
|
91 | /**
|
92 | * Background color to use for light mode.
|
93 | * Default #dcdad7
|
94 | */
|
95 | lightSchemeBackgroundColor: string;
|
96 | /**
|
97 | * Text color to use for light mode.
|
98 | * Default #181a1b
|
99 | */
|
100 | lightSchemeTextColor: string;
|
101 | /**
|
102 | * Scrollbar color
|
103 | * Default auto
|
104 | */
|
105 | scrollbarColor: string;
|
106 | /**
|
107 | * Selection color
|
108 | * Default auto
|
109 | */
|
110 | selectionColor: string;
|
111 | /**
|
112 | * Specifies if it has to style system controls/
|
113 | * Default true
|
114 | */
|
115 | styleSystemControls: boolean;
|
116 | }
|
117 |
|
118 | /**
|
119 | * Contains fixes for the generated theme.
|
120 | */
|
121 | interface DynamicThemeFix {
|
122 | /**
|
123 | * List of CSS selectors that should be inverted.
|
124 | * Usually icons that are contained in sprites.
|
125 | */
|
126 | invert: string[];
|
127 | /**
|
128 | * Additional CSS.
|
129 | * ${color} template should be used to apply theme options to a color.
|
130 | * Example:
|
131 | * ```
|
132 | * body {
|
133 | * background-color: ${white} !important;
|
134 | * background-image: none !important;
|
135 | * }
|
136 | * ```
|
137 | */
|
138 | css: string;
|
139 | /**
|
140 | * List of CSS selectors where it's inline style should not be analyzed
|
141 | * Mostly used for color pickers
|
142 | */
|
143 | ignoreInlineStyle: string[];
|
144 | /**
|
145 | * List of CSS selectors where it's image should not be analyzed
|
146 | * Mostly used for wrongly inverted background-images
|
147 | */
|
148 | ignoreImageAnalysis: string[];
|
149 | }
|
150 | }
|
151 |
|
152 | declare module 'darkreader' {
|
153 | export = DarkReader;
|
154 | }
|