Skip to content

Commit 465562c

Browse files
lawgsyogustavo-pereira
authored andcommitted
Style scrollbars (#422)
* Make scrollbars themeable * Add styles to default themes * Resize resultlist upon opening preview (to allow for styled scrollbar) * Spaces around infix operator (AppVeyor) * Convert tabs to spaces (seriously?)
1 parent 97cf225 commit 465562c

File tree

4 files changed

+63
-2
lines changed

4 files changed

+63
-2
lines changed

app/main/components/Cerebro/styles.css

+39
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,42 @@
2424
color: var(--secondary-font-color);
2525
white-space: pre;
2626
}
27+
28+
::-webkit-scrollbar {
29+
height: var(--scroll-height);
30+
width: var(--scroll-width);
31+
background: var(--scroll-background);
32+
-webkit-border-radius: 0;
33+
}
34+
35+
::-webkit-scrollbar-track {
36+
background: var(--scroll-track);
37+
}
38+
::-webkit-scrollbar-track:active {
39+
background: var(--scroll-track-active);
40+
}
41+
42+
::-webkit-scrollbar-track:hover {
43+
background: var(--scroll-track-hover);
44+
}
45+
46+
::-webkit-scrollbar-thumb {
47+
background: var(--scroll-thumb);
48+
-webkit-border-radius: 3px;
49+
}
50+
51+
::-webkit-scrollbar-thumb:hover {
52+
background: var(--scroll-thumb-hover);
53+
}
54+
55+
::-webkit-scrollbar-thumb:active {
56+
background: var(--scroll-thumb-active);
57+
}
58+
59+
::-webkit-scrollbar-thumb:vertical {
60+
min-height: 10px;
61+
}
62+
63+
::-webkit-scrollbar-thumb:horizontal {
64+
min-width: 10px;
65+
}

app/main/components/ResultsList/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ResultsList extends Component {
6868
rowCount={results.length}
6969
rowHeight={RESULT_HEIGHT}
7070
rowRenderer={this.rowRenderer}
71-
width={10000}
71+
width={(results[selected] !== undefined && results[selected].getPreview) ? 250 : 10000}
7272
scrollToIndex={selected}
7373
// Needed to force update of VirtualScroll
7474
titles={results.map(result => result.title)}

app/main/css/themes/dark.css

+12-1
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,22 @@
2020
--selected-result-subtitle-color: var(--result-subtitle-color);
2121
--selected-result-background: #1972D6;
2222

23+
/* scrollbar */
24+
--scroll-background: var(--main-background-color);
25+
--scroll-track: #2E2E2C;
26+
--scroll-track-active: var(--scroll-track);
27+
--scroll-track-hover: var(--scroll-track);
28+
--scroll-thumb: var(--secondary-font-color);
29+
--scroll-thumb-hover: var(--scroll-thumb);
30+
--scroll-thumb-active: var(--main-font-color);
31+
--scroll-width: 5px;
32+
--scroll-height: 5px;
33+
2334
/* inputs */
2435
--preview-input-background: #2E2E2C;
2536
--preview-input-color: var(--main-font-color);
2637
--preview-input-border: 0;
2738

2839
/* filter for previews */
29-
--preview-filter: invert(100%) hue-rotate(180deg) contrast(80%);;
40+
--preview-filter: invert(100%) hue-rotate(180deg) contrast(80%);
3041
}

app/main/css/themes/light.css

+11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
--selected-result-subtitle-color: var(--result-subtitle-color);
2121
--selected-result-background: rgba(18, 110, 219, 1);
2222

23+
/* scrollbar */
24+
--scroll-background: var(--main-background-color);
25+
--scroll-track: #e0e0e0;
26+
--scroll-track-active: var(--scroll-track);
27+
--scroll-track-hover: var(--scroll-track);
28+
--scroll-thumb: var(--secondary-font-color);
29+
--scroll-thumb-hover: var(--scroll-thumb);
30+
--scroll-thumb-active: var(--main-font-color);
31+
--scroll-width: 5px;
32+
--scroll-height: 5px;
33+
2334
/* inputs */
2435
--preview-input-background: white;
2536
--preview-input-color: var(--main-font-color);

0 commit comments

Comments
 (0)