Skip to content

Commit 77310aa

Browse files
authored
Add main scrollbar dark mode support and improve scrollbar styles (#2021)
1 parent 3f99cd3 commit 77310aa

File tree

6 files changed

+10
-66
lines changed

6 files changed

+10
-66
lines changed

assets/css/autocomplete.css

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
white-space: normal;
115115
overflow-x: hidden;
116116
overscroll-behavior-y: contain;
117+
scrollbar-width: thin;
117118
}
118119

119120
.autocomplete-suggestions.previewing:has(.selected) {
@@ -234,26 +235,6 @@
234235
text-decoration: none !important;
235236
}
236237

237-
/* Style the scrollbar track (the area behind the thumb) */
238-
.autocomplete-suggestions::-webkit-scrollbar {
239-
width: 5px;
240-
/* Set the width of the scrollbar */
241-
border-radius: 7px;
242-
/* Add rounded corners to the thumb */
243-
flex-shrink: 0;
244-
}
245-
246-
/* Style the scrollbar thumb (the draggable part) */
247-
.autocomplete-suggestions::-webkit-scrollbar-thumb {
248-
background-color: var(--autocompleteScrollbarThumb);
249-
border-radius: 7px;
250-
}
251-
252-
/* Style the scrollbar track on hover */
253-
.autocomplete-suggestions::-webkit-scrollbar-track {
254-
background-color: var(--autocompleteScrollbarTrack);
255-
}
256-
257238
@media screen and (hover: none) {
258239
.autocomplete-preview-indicator {
259240
display: none !important;

assets/css/content/cheatsheet.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,6 @@
114114
padding: var(--vertical-space) var(--horizontal-space);
115115
}
116116

117-
.page-cheatmd .content-inner pre code::-webkit-scrollbar {
118-
width: 0.4rem;
119-
height: 0.6rem;
120-
}
121-
122117
.page-cheatmd .content-inner .h2 pre {
123118
margin: 0;
124119
}

assets/css/content/code.css

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,7 @@
2727
overflow-x: auto;
2828
white-space: inherit;
2929
padding: .5em 1em;
30-
}
31-
32-
.content-inner pre code::-webkit-scrollbar {
33-
width: .4rem;
34-
height: .4rem;
35-
}
36-
37-
.content-inner pre code::-webkit-scrollbar-thumb {
38-
border-radius: .25rem;
39-
background-color: var(--codeScrollThumb);
40-
}
41-
42-
.content-inner pre code::-webkit-scrollbar-track {
43-
background-color: var(--codeScrollBackground);
44-
}
45-
46-
.content-inner pre code::-webkit-scrollbar-corner {
47-
background-color: var(--codeScrollBackground);
30+
scrollbar-width: thin;
4831
}
4932

5033
.content-inner pre code.output {

assets/css/custom-props/theme-dark.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ body.dark {
7878
--sidebarHeader: var(--gray700);
7979
--sidebarMuted: var(--gray300);
8080
--sidebarHover: var(--white);
81-
--sidebarScrollbarThumb: var(--coldGray);
82-
--sidebarScrollbarTrack: var(--sidebarBackground);
8381
--sidebarStaleVersion: var(--orangeLight);
8482
--sidebarSubheadings: var(--gray400);
8583
--sidebarItem: var(--gray200);
@@ -98,8 +96,10 @@ body.dark {
9896
--suggestionBorder: var(--gray600);
9997
--autocompleteResults: var(--gray200);
10098
--autocompleteResultsBold: var(--gray100);
101-
--autocompleteScrollbarThumb: var(--gray600);
102-
--autocompleteScrollbarTrack: var(--gray850);
10399
--autocompleteLabelBack: var(--gray600);
104100
--autocompleteLabelFont: rgba(255, 255, 255, 0.8);
105101
}
102+
103+
:root:has(body.dark) {
104+
color-scheme: dark;
105+
}

assets/css/custom-props/theme-light.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878
--sidebarHeader: var(--gray100);
7979
--sidebarMuted: var(--gray800);
8080
--sidebarHover: var(--black);
81-
--sidebarScrollbarThumb: var(--coldGrayLight);
82-
--sidebarScrollbarTrack: var(--sidebarBackground);
8381
--sidebarStaleVersion: var(--orangeDark);
8482
--sidebarSubheadings: var(--black);
8583
--sidebarItem: var(--black);
@@ -99,8 +97,6 @@
9997
--suggestionBorder: var(--gray200);
10098
--autocompleteResults: var(--gray600);
10199
--autocompleteResultsBold: var(--gray800);
102-
--autocompleteScrollbarThumb: var(--gray200);
103-
--autocompleteScrollbarTrack: var(--gray50);
104100
--autocompleteLabelBack: var(--gray100);
105101
--autocompleteLabelFont: var(--gray600);
106102
}

assets/css/sidebar.css

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
background-color: var(--sidebarBackground);
99
color: var(--sidebarAccentMain);
1010
overflow: hidden;
11-
scrollbar-color: var(--sidebarScrollbarThumb) var(--sidebarScrollbarTrack);
11+
12+
& .sidebar-tabpanel {
13+
scrollbar-width: thin;
14+
}
1215
}
1316

1417
:root:not(.apple-os) .sidebar {
@@ -358,20 +361,6 @@
358361
border-color: var(--sidebarLanguageAccentBar);
359362
}
360363

361-
.sidebar ::-webkit-scrollbar {
362-
width: 14px;
363-
}
364-
365-
::-webkit-scrollbar-track {
366-
background-color: var(--sidebarBackground);
367-
}
368-
369-
.sidebar ::-webkit-scrollbar-thumb {
370-
background-color: var(--sidebarScrollbarThumb);
371-
border-radius: 10px;
372-
border: 3px solid var(--sidebarBackground);
373-
}
374-
375364
.sidebar-button {
376365
cursor: pointer;
377366
background-color: transparent;

0 commit comments

Comments
 (0)