Skip to content

Commit 3f61c73

Browse files
authored
Rollup merge of #70656 - GuillaumeGomez:scrollbar-display, r=kinnison
Improve scrollbar display in rustdoc The scrollbar of the left sidebar in rustdoc looks very bad on firefox (on dark theme). This PR improves it: <div style="display:inline-block;"> <div style="width:50%;display:inline-block;float:left;"> <image src="https://user-images.githubusercontent.com/3050060/78148412-202b0380-7435-11ea-8ff3-79f02ea8f9ed.png"> </div> <div style="width:50%;display:inline-block;float:left;"> <image src="https://user-images.githubusercontent.com/3050060/78148437-28833e80-7435-11ea-946b-a6fc9320b705.png"> </div> </div> With light theme: ![old-firefox-light](https://user-images.githubusercontent.com/3050060/78148718-7bf58c80-7435-11ea-93d3-2a2cafd5c6ae.png) ![firefox-light](https://user-images.githubusercontent.com/3050060/78148736-7f891380-7435-11ea-8b10-a8898f73b4c9.png) And on chrome: ![chrome-light](https://user-images.githubusercontent.com/3050060/78148903-ac3d2b00-7435-11ea-9a10-6c0376a675c3.png) ![chrome-dark](https://user-images.githubusercontent.com/3050060/78148907-ae9f8500-7435-11ea-9b89-0397b977753c.png) Small extra question: should I extend it to all scrollbars? I think it'd be better but just in case... r? @kinnison
2 parents 5179ebe + cbee6c5 commit 3f61c73

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

src/librustdoc/html/static/rustdoc.css

+19
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,25 @@ nav.sub {
184184
overflow: auto;
185185
}
186186

187+
/* Improve the scrollbar display on firefox */
188+
* {
189+
scrollbar-width: initial;
190+
}
191+
.sidebar {
192+
scrollbar-width: thin;
193+
}
194+
195+
/* Improve the scrollbar display on webkit-based browsers */
196+
::-webkit-scrollbar {
197+
width: 12px;
198+
}
199+
.sidebar::-webkit-scrollbar {
200+
width: 8px;
201+
}
202+
::-webkit-scrollbar-track {
203+
-webkit-box-shadow: inset 0;
204+
}
205+
187206
.sidebar .block > ul > li {
188207
margin-right: -10px;
189208
}

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

+22
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,28 @@ pre {
3232
background-color: #505050;
3333
}
3434

35+
/* Improve the scrollbar display on firefox */
36+
* {
37+
scrollbar-color: rgb(64, 65, 67) #717171;
38+
}
39+
.sidebar {
40+
scrollbar-color: rgba(32,34,37,.6) transparent;
41+
}
42+
43+
/* Improve the scrollbar display on webkit-based browsers */
44+
::-webkit-scrollbar-track {
45+
background-color: #717171;
46+
}
47+
::-webkit-scrollbar-thumb {
48+
background-color: rgba(32, 34, 37, .6);
49+
}
50+
.sidebar::-webkit-scrollbar-track {
51+
background-color: #717171;
52+
}
53+
.sidebar::-webkit-scrollbar-thumb {
54+
background-color: rgba(32, 34, 37, .6);
55+
}
56+
3557
.sidebar .current {
3658
background-color: #333;
3759
}

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

+23
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,29 @@ pre {
3434
background-color: #F1F1F1;
3535
}
3636

37+
/* Improve the scrollbar display on firefox */
38+
* {
39+
scrollbar-color: rgba(36, 37, 39, 0.6) #e6e6e6;
40+
}
41+
42+
.sidebar {
43+
scrollbar-color: rgba(36, 37, 39, 0.6) #d9d9d9;
44+
}
45+
46+
/* Improve the scrollbar display on webkit-based browsers */
47+
::-webkit-scrollbar-track {
48+
background-color: #ecebeb;
49+
}
50+
::-webkit-scrollbar-thumb {
51+
background-color: rgba(36, 37, 39, 0.6);
52+
}
53+
.sidebar::-webkit-scrollbar-track {
54+
background-color: #dcdcdc;
55+
}
56+
.sidebar::-webkit-scrollbar-thumb {
57+
background-color: rgba(36, 37, 39, 0.6);
58+
}
59+
3760
.sidebar .current {
3861
background-color: #fff;
3962
}

0 commit comments

Comments
 (0)