Skip to content

Commit 5d7e5ee

Browse files
committed
Improve rendering with high-contrast theme
Related issue: uBlockOrigin/uBlock-issues#3385
1 parent bc4e829 commit 5d7e5ee

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/css/common.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ button {
8080
appearance: none;
8181
-moz-appearance: none;
8282
-webkit-appearance: none;
83-
border: 0;
83+
border: var(--button-border-size) solid var(--ink-1);
8484
border-radius: var(--button-border-radius);
8585
background-color: var(--button-surface);
8686
color: var(--button-ink);
@@ -193,7 +193,7 @@ label:hover .checkbox:not([disabled]) {
193193
height: 100%;
194194
margin: 0;
195195
min-width: var(--checkbox-size);
196-
opacity: 0;
196+
opacity: var(--native-control-opacity);
197197
position: absolute;
198198
width: 100%;
199199
}
@@ -204,6 +204,7 @@ label:hover .checkbox:not([disabled]) {
204204
box-sizing: border-box;
205205
fill: none;
206206
height: 100%;
207+
opacity: calc(1 - var(--native-control-opacity));
207208
pointer-events: none;
208209
position: absolute;
209210
stroke: none;
@@ -242,14 +243,15 @@ label:hover .checkbox:not([disabled]) {
242243
height: 100%;
243244
margin: 0;
244245
min-width: var(--checkbox-size);
245-
opacity: 0;
246+
opacity: var(--native-control-opacity);
246247
position: absolute;
247248
width: 100%;
248249
}
249250
.radio > input[type="radio"] + svg {
250251
background-color: transparent;
251252
box-sizing: border-box;
252253
height: 100%;
254+
opacity: calc(1 - var(--native-control-opacity));
253255
pointer-events: none;
254256
position: absolute;
255257
width: 100%;

src/css/themes/default.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,11 @@
408408
--fieldset-header-surface: transparent;
409409
--fieldset-header-ink: var(--ink-2);
410410

411+
--native-control-opacity: 0;
412+
411413
--button-ink: var(--ink-1);
412414
--button-surface: rgb(var(--button-surface-rgb));
415+
--button-border-size: 0;
413416
--button-border-radius: 5px;
414417
--button-preferred-ink: var(--accent-ink-1);
415418
--button-preferred-surface: var(--accent-surface-1);
@@ -462,7 +465,8 @@
462465

463466
@media (prefers-contrast: more) {
464467
:root {
465-
--checkbox-checked-ink: var(--ink-1);
468+
--native-control-opacity: 1;
469+
--button-border-size: 1px;
466470
}
467471
}
468472

0 commit comments

Comments
 (0)