Skip to content

Commit b53817d

Browse files
authored
Rollup merge of #110205 - notriddle:notriddle/pixelated-border, r=GuillaumeGomez
rustdoc: make settings radio and checks thicker, less contrast This is very dependent on subjectivity and what screen you use, but this change makes the radio buttons' outer circle less ugly. This is because I could see the pixels very clearly, thanks to the very thin line and high contrast. This change makes both less severe, giving your browser's antialiasing algorithm more to work with. Since it's thicker, lowering the contrast shouldn't impact visibility. ## Preview https://notriddle.com/rustdoc-demo-html-3/pixelated-border/settings.html ## Before ![image](https://user-images.githubusercontent.com/1593513/231274191-143acbea-c433-4fb1-b46d-e5e4fe328d60.png) ## After ![image](https://user-images.githubusercontent.com/1593513/231287415-c1e59fe8-8bf8-489d-b607-95ebb71e4ac5.png) <details><summary>Original "after" image with 2px border around checked box</summary> ![image](https://user-images.githubusercontent.com/1593513/231274253-8b5011c6-82fb-4396-84d0-47b6bdff2260.png) </details>
2 parents a34bcd7 + ad9a89e commit b53817d

File tree

5 files changed

+75
-8
lines changed

5 files changed

+75
-8
lines changed

src/librustdoc/html/static/css/settings.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
height: 1.2rem;
99
width: 1.2rem;
1010
color: inherit;
11-
border: 1px solid currentColor;
11+
border: 2px solid var(--settings-input-border-color);
1212
outline: none;
1313
-webkit-appearance: none;
1414
cursor: pointer;
@@ -52,6 +52,7 @@
5252
}
5353
.setting-check input:checked {
5454
background-color: var(--settings-input-color);
55+
border-width: 1px;
5556
}
5657
.setting-radio input:focus, .setting-check input:focus {
5758
box-shadow: 0 0 1px 1px var(--settings-input-color);

src/librustdoc/html/static/css/themes/ayu.css

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
77
--main-background-color: #0f1419;
88
--main-color: #c5c5c5;
99
--settings-input-color: #ffb454;
10+
--settings-input-border-color: #999;
1011
--settings-button-color: #fff;
1112
--settings-button-border-focus: #e0e0e0;
1213
--sidebar-background-color: #14191f;

src/librustdoc/html/static/css/themes/dark.css

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
--main-background-color: #353535;
33
--main-color: #ddd;
44
--settings-input-color: #2196f3;
5+
--settings-input-border-color: #999;
56
--settings-button-color: #000;
67
--settings-button-border-focus: #ffb900;
78
--sidebar-background-color: #505050;

src/librustdoc/html/static/css/themes/light.css

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
--main-background-color: white;
33
--main-color: black;
44
--settings-input-color: #2196f3;
5+
--settings-input-border-color: #717171;
56
--settings-button-color: #000;
67
--settings-button-border-focus: #717171;
78
--sidebar-background-color: #F5F5F5;

tests/rustdoc-gui/settings.goml

+70-7
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,49 @@ move-cursor-to: "#settings-menu > a"
5656
assert-css: (
5757
"#theme-dark",
5858
{
59-
"border-color": "rgb(221, 221, 221)",
59+
"border-color": "rgb(153, 153, 153)",
6060
"box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset",
61+
"border-width": "2px",
6162
},
6263
)
63-
assert-css: ("#theme-light", {"border-color": "rgb(221, 221, 221)", "box-shadow": "none"})
64+
assert-css: ("#theme-light", {"border-color": "rgb(153, 153, 153)", "box-shadow": "none"})
6465
// Let's start with the hover for radio buttons.
6566
move-cursor-to: "#theme-dark"
6667
assert-css: (
6768
"#theme-dark",
6869
{
6970
"border-color": "rgb(33, 150, 243)",
7071
"box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset",
72+
"border-width": "2px",
7173
},
7274
)
7375
move-cursor-to: "#theme-light"
74-
assert-css: ("#theme-light", {"border-color": "rgb(33, 150, 243)", "box-shadow": "none"})
76+
assert-css: (
77+
"#theme-light",
78+
{
79+
"border-color": "rgb(33, 150, 243)",
80+
"box-shadow": "none",
81+
"border-width": "2px",
82+
}
83+
)
7584
move-cursor-to: "#theme-ayu"
7685
// Let's now check with the focus for radio buttons.
7786
focus: "#theme-dark"
7887
assert-css: (
7988
"#theme-dark",
8089
{
81-
"border-color": "rgb(221, 221, 221)",
90+
"border-color": "rgb(153, 153, 153)",
8291
"box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset, rgb(33, 150, 243) 0px 0px 2px 2px",
92+
"border-width": "2px",
8393
},
8494
)
8595
focus: "#theme-light"
8696
assert-css: (
8797
"#theme-light",
8898
{
89-
"border-color": "rgb(221, 221, 221)",
99+
"border-color": "rgb(153, 153, 153)",
90100
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
101+
"border-width": "2px",
91102
},
92103
)
93104
// Now we check we both focus and hover for radio buttons.
@@ -98,6 +109,7 @@ assert-css: (
98109
{
99110
"border-color": "rgb(33, 150, 243)",
100111
"box-shadow": "rgb(53, 53, 53) 0px 0px 0px 3px inset, rgb(33, 150, 243) 0px 0px 2px 2px",
112+
"border-width": "2px",
101113
},
102114
)
103115
move-cursor-to: "#theme-light"
@@ -107,6 +119,7 @@ assert-css: (
107119
{
108120
"border-color": "rgb(33, 150, 243)",
109121
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
122+
"border-width": "2px",
110123
},
111124
)
112125
// Now we check the setting-radio-name is on a different line than the label.
@@ -142,7 +155,18 @@ assert-css: (
142155
"#auto-hide-large-items",
143156
{
144157
"background-color": "rgb(33, 150, 243)",
145-
"border-color": "rgb(221, 221, 221)",
158+
"border-color": "rgb(153, 153, 153)",
159+
// 1px border when checked
160+
"border-width": "1px",
161+
},
162+
)
163+
assert-css: (
164+
"#auto-hide-method-docs",
165+
{
166+
"background-color": "rgba(0, 0, 0, 0)",
167+
"border-color": "rgb(153, 153, 153)",
168+
// 2px border when unchecked
169+
"border-width": "2px",
146170
},
147171
)
148172
// Let's start with the hover for toggles.
@@ -152,6 +176,18 @@ assert-css: (
152176
{
153177
"background-color": "rgb(33, 150, 243)",
154178
"border-color": "rgb(33, 150, 243)",
179+
// 1px border when checked
180+
"border-width": "1px",
181+
},
182+
)
183+
move-cursor-to: "#auto-hide-method-docs"
184+
assert-css: (
185+
"#auto-hide-method-docs",
186+
{
187+
"background-color": "rgba(0, 0, 0, 0)",
188+
"border-color": "rgb(33, 150, 243)",
189+
// 2px border when unchecked
190+
"border-width": "2px",
155191
},
156192
)
157193
move-cursor-to: "#settings-menu > a"
@@ -161,8 +197,21 @@ assert-css: (
161197
"#auto-hide-large-items",
162198
{
163199
"background-color": "rgb(33, 150, 243)",
164-
"border-color": "rgb(221, 221, 221)",
200+
"border-color": "rgb(153, 153, 153)",
201+
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
202+
// 1px border when checked
203+
"border-width": "1px",
204+
},
205+
)
206+
focus: "#auto-hide-method-docs"
207+
assert-css: (
208+
"#auto-hide-method-docs",
209+
{
210+
"background-color": "rgba(0, 0, 0, 0)",
211+
"border-color": "rgb(153, 153, 153)",
165212
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
213+
// 2px border when unchecked
214+
"border-width": "2px",
166215
},
167216
)
168217
// Now we check we both focus and hover for toggles.
@@ -174,6 +223,20 @@ assert-css: (
174223
"background-color": "rgb(33, 150, 243)",
175224
"border-color": "rgb(33, 150, 243)",
176225
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
226+
// 1px border when checked
227+
"border-width": "1px",
228+
},
229+
)
230+
move-cursor-to: "#auto-hide-method-docs"
231+
focus: "#auto-hide-method-docs"
232+
assert-css: (
233+
"#auto-hide-method-docs",
234+
{
235+
"background-color": "rgba(0, 0, 0, 0)",
236+
"border-color": "rgb(33, 150, 243)",
237+
"box-shadow": "rgb(33, 150, 243) 0px 0px 1px 1px",
238+
// 2px border when unchecked
239+
"border-width": "2px",
177240
},
178241
)
179242

0 commit comments

Comments
 (0)