forked from abstiles/deluminate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeluminate.css
273 lines (257 loc) · 7.96 KB
/
deluminate.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/* Invert the luminance iff any of the "delumine" styles are selected. */
html[hc^="delumine"] {
-webkit-filter: invert() hue-rotate(180deg) brightness(105%) contrast(105%);
}
html[hc^="delumine"][hc*="kill_background"],
html[hc^="delumine"][hc*="kill_background"] body {
background-image: none !important;
background-color: #FFF !important;
color: #BBB !important;
}
html[hc^="noinvert"][hc*="kill_background"],
html[hc^="noinvert"][hc*="kill_background"] body {
background-image: none !important;
background-color: #000 !important;
color: #BBB !important;
}
html[hc*="kill_background"] * {
color: #BBB !important;
}
html[hc*="kill_background"] *[deluminate_imagetype]:not(img):not(a) {
background-image: none !important;
background-color: none !important;
color: #BBB !important;
text-indent: 0 !important;
}
/* Override the above with a low-contrast version if selected. */
html[hc^="delumine"][hc*="low-contrast"] {
-webkit-filter: invert() hue-rotate(180deg) brightness(105%) contrast(85%);
}
/* Lower the contrast without inverting the luminance. */
html[hc^="noinvert-low-contrast"] {
-webkit-filter: contrast(85%);
}
/* Lower the brightness without inverting the luminance. */
html[hc^="noinvert-dim1"] {
-webkit-filter: brightness(90%);
}
html[hc^="noinvert-dim2"] {
-webkit-filter: brightness(80%);
}
html[hc^="noinvert-dim3"] {
-webkit-filter: brightness(70%);
}
html[hc^="noinvert-dim4"] {
-webkit-filter: brightness(60%);
}
html[hc^="noinvert-dim5"] {
-webkit-filter: brightness(50%);
}
/* The low-contrast version of the above. */
html[hc^="noinvert-dim1"][hc*="low-contrast"] {
-webkit-filter: contrast(85%) brightness(90%);
}
html[hc^="noinvert-dim2"][hc*="low-contrast"] {
-webkit-filter: contrast(85%) brightness(80%);
}
html[hc^="noinvert-dim3"][hc*="low-contrast"] {
-webkit-filter: contrast(85%) brightness(70%);
}
html[hc^="noinvert-dim4"][hc*="low-contrast"] {
-webkit-filter: contrast(85%) brightness(60%);
}
html[hc^="noinvert-dim5"][hc*="low-contrast"] {
-webkit-filter: contrast(85%) brightness(50%);
}
/* Workaround for new issue in Chrome 36 that prevents the filter from applying
* across the entire window when the page doesn't fill the window. Force the
* page to fill the window with this element that fills the screen.
*/
#deluminate_fullscreen_workaround {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: block;
z-index: -1;
}
#deluminate_fullscreen_workaround[enabled="true"] {
visibility: visible;
}
#deluminate_fullscreen_workaround[enabled="false"] {
visibility: hidden;
}
/* Workaround for blurriness on high dpi displays. See Chromium issue 156019. */
html[hc*="hw_accel"] {
-webkit-backface-visibility: hidden;
}
/* Uninvert select items within the document.
* Note: Chrome clears -webkit-filter on all full-screen ancestor tags, killing
* the top-level delumination filter. This is usually desirable (e.g., for
* Youtube videos), so instead of fighting it, just avoid trying to "uninvert"
* images in this scenario.
*/
/* Uninvert dialog boxes (except the "Compose" box in Gmail, identified by the
* "aria-labelledby" attribute. */
html[hc*="delumine"]:not(*:-webkit-full-screen-ancestor) [role="dialog"]:not([aria-labelledby]) {
-webkit-filter: contrast(95%) brightness(95%) hue-rotate(180deg) invert();
}
/* For the -noimg variant, uninvert all images. */
html[hc*="delumine-noimg"]:not(*:-webkit-full-screen-ancestor) :-webkit-any(
img,
/* Check for "url" in the style attribute, which is usually a fancy way to specify an image */
[style*="url"],
[deluminate_imageType],
canvas,
embed,
object,
video) {
-webkit-filter: contrast(95%) brightness(95%) hue-rotate(180deg) invert();
}
/* Avoid performing the uninversion process on anything that is a descendant of
* something uninverted. */
html[hc*="delumine-noimg"]:not(*:-webkit-full-screen-ancestor) :-webkit-any(
img,
[style*="url"],
[deluminate_imageType],
[role="dialog"],
canvas,
embed,
object,
video) :-webkit-any(
img,
[style*="url"],
[deluminate_imageType],
[role="dialog"],
canvas,
embed,
object,
video) {
-webkit-filter: none;
}
/* The "smart" filter is more selective about what to uninvert. */
html[hc*="delumine-smart"]:not(*:-webkit-full-screen-ancestor) body :-webkit-any(
/* Leave PNG and GIF format images inverted, since they usually are
* identifiable even when inverted. */
img:not([src$=".png"]):not([src$=".gif"]):not([src$=".PNG"]):not([src$=".GIF"]):not([src^="data:image"]),
[itemprop="photo"],
[itemprop="image"],
[src^="data:image/jpeg"],
[deluminate_imageType="jpg"],
[deluminate_imageType="animated gif"],
[style*=".jpg"],
[style*=".JPG"],
[style*=".jpeg"],
[style*=".JPEG"],
[style*=".webp"],
[style*=".WEBP"],
/* It's usually not desireable to invert these tags. */
canvas,
embed:not([type$="pdf"]),
object,
video),
/* Handle PDF previews in Gmail by reinverting the uninverted document in the
* dialog. */
html[hc*="delumine-smart"]:not(*:-webkit-full-screen-ancestor) [role="dialog"] [role="document"] {
-webkit-filter: contrast(95%) brightness(95%) hue-rotate(180deg) invert();
}
/* Avoid performing the uninversion process on anything that is a descendant of
* something uninverted. */
html[hc*="delumine-smart"]:not(*:-webkit-full-screen-ancestor) body :-webkit-any(
img:not([src$=".png"]):not([src$=".gif"]):not([src$=".PNG"]):not([src$=".GIF"]):not([src^="data:image"]),
[itemprop="photo"],
[itemprop="image"],
[src^="data:image/jpeg"],
[deluminate_imageType="jpg"],
[style*=".jpg"],
[style*=".JPG"],
[style*=".jpeg"],
[style*=".JPEG"],
[style*=".webp"],
[style*=".WEBP"],
[role="dialog"],
canvas,
embed:not([type$="pdf"]),
object,
video) :-webkit-any(
img:not([src$=".png"]):not([src$=".gif"]):not([src$=".PNG"]):not([src$=".GIF"]):not([src^="data:image"]),
[itemprop="photo"],
[itemprop="image"],
[src^="data:image/jpeg"],
[deluminate_imageType="jpg"],
[style*=".jpg"],
[style*=".JPG"],
[style*=".jpeg"],
[style*=".JPEG"],
[style*=".webp"],
[style*=".WEBP"],
[role="dialog"],
canvas,
embed:not([type$="pdf"]),
object,
video) {
-webkit-filter: none;
}
/* Reinvert all images that have been uninverted collectively by being in a dialog. */
html[hc*="delumine-all"]:not(*:-webkit-full-screen-ancestor) [role="dialog"] :-webkit-any(
img,
[deluminate_imageType],
[style*="url"],
canvas,
embed,
object,
video) {
-webkit-filter: contrast(95%) brightness(95%) hue-rotate(180deg) invert();
}
/* Avoid performing the reinversion process on anything that is a descendant of
* something reinverted. */
html[hc*="delumine-all"]:not(*:-webkit-full-screen-ancestor) [role="dialog"] :-webkit-any(
img,
[deluminate_imageType],
[style*="url"],
canvas,
embed,
object,
video) :-webkit-any(
img,
[deluminate_imageType],
[style*="url"],
canvas,
embed,
object,
video) {
-webkit-filter: none;
}
/* Force text to plain black text on white (which, when inverted, is the
* preferable white text on black. */
html[hc*="delumine"][hc*="force_text"] input[type="text"] {
background-image: none !important;
background-color: white !important;
color: black !important;
}
/* ...unless it's uninverted because of a background image. Then set it
* directly to white text on black. */
html[hc*="delumine-smart"][hc*="force_text"] input[type="text"]:-webkit-any(
[src^="data:image/jpeg"],
[deluminate_imageType="jpg"],
[style*=".jpg"],
[style*=".JPG"],
[style*=".jpeg"],
[style*=".JPEG"]) {
background-image: none !important;
background-color: black !important;
color: white !important;
}
html[hc*="delumine-noimg"][hc*="force_text"] input[style*="url"]:-webkit-any(
[type="text"], [dir]) {
background-image: none !important;
background-color: black !important;
color: white !important;
}
/* Crude workaround for my inability to inject deluminate into preview iframes
* on the new tab page. */
html[hc*="delumine-noimg"] iframe[src^="chrome-search://most-visited"],
html[hc*="delumine-smart"] iframe[src^="chrome-search://most-visited"] {
-webkit-filter: contrast(95%) brightness(95%) hue-rotate(180deg) invert();
}