Skip to content

Build your personal knowledge base with Trilium Notes

style(next): restyle WebKit scrollbars

Adorian Doranc2d917b9262f
diff --git a/src/public/stylesheets/theme-next-dark.css b/src/public/stylesheets/theme-next-dark.css
index 87353887b5..84a0e0eb90 100644
--- a/src/public/stylesheets/theme-next-dark.css
+++ b/src/public/stylesheets/theme-next-dark.css
@@ -190,8 +190,11 @@
--right-pane-item-hover-background: #ffffff26;
--right-pane-item-hover-color: white;
- --scrollbar-border-color: #666;
- --scrollbar-background-color: #333;
+ --scrollbar-thumb-color: #fdfdfd5c;
+ --scrollbar-thumb-color-hover: #ffffff7d;
+ --scrollbar-border-color: unset; /* Deprecated */
+ --scrollbar-background-color: unset; /* Deprecated */
+
--link-color: lightskyblue;
--mermaid-theme: dark;
diff --git a/src/public/stylesheets/theme-next-light.css b/src/public/stylesheets/theme-next-light.css
index 4060daf87a..781a34a2b5 100644
--- a/src/public/stylesheets/theme-next-light.css
+++ b/src/public/stylesheets/theme-next-light.css
@@ -189,8 +189,11 @@
--right-pane-item-hover-background: #ececec;
--right-pane-item-hover-color: inherit;
- --scrollbar-border-color: #ddd;
- --scrollbar-background-color: #ddd;
+ --scrollbar-thumb-color: #0000005c;
+ --scrollbar-thumb-color-hover: #00000066;
+ --scrollbar-border-color: unset; /* Deprecated */
+ --scrollbar-background-color: unset; /* Deprecated */
+
--link-color: blue;
--mermaid-theme: default;
diff --git a/src/public/stylesheets/theme-next/forms.css b/src/public/stylesheets/theme-next/forms.css
index 671a90997e..402f332dcd 100644
--- a/src/public/stylesheets/theme-next/forms.css
+++ b/src/public/stylesheets/theme-next/forms.css
@@ -660,3 +660,61 @@ a.tn-link:hover[href^="https://"]:not(.no-arrow)::after,
input[type="range"] {
background: transparent;
}
+
+/*
+ * WebKit scrollbars
+ */
+
+:root {
+ --scrollbar-thickness: 10px;
+ --scrollbar-thumb-thickness: 3px;
+ --scrollbar-thumb-hover-thickness: 8px;
+ --scrollbar-start-end-gap: 8px;
+}
+
+/* Scrollbar's body */
+
+::-webkit-scrollbar:vertical {
+ width: var(--scrollbar-thickness) !important;
+}
+
+::-webkit-scrollbar:horizontal {
+ height: var(--scrollbar-thickness) !important;
+}
+
+/* Scrollbar's thumb */
+
+::-webkit-scrollbar-thumb {
+ --s-thumb-thickness: var(--scrollbar-thumb-thickness);
+ --s-thumb-color: var(--scrollbar-thumb-color);
+
+ --s-gradient-angle: 90deg;
+ --s-gradient-p1: calc((var(--scrollbar-thickness) - var(--s-thumb-thickness)) / 2);
+ --s-gradient-p2: calc(var(--s-gradient-p1) + var(--s-thumb-thickness));
+
+ border: none !important;
+ background: linear-gradient(var(--s-gradient-angle), transparent, transparent var(--s-gradient-p1),
+ var(--s-thumb-color) 0px, var(--s-thumb-color) var(--s-gradient-p2),
+ transparent 0) !important;
+
+ border-radius: calc(var(--scrollbar-thickness) / 2) !important;
+}
+
+::-webkit-scrollbar-thumb:horizontal {
+ --s-gradient-angle: 0deg;
+}
+
+::-webkit-scrollbar-thumb:hover {
+ --s-thumb-thickness: var(--scrollbar-thumb-hover-thickness);
+ --s-thumb-color: var(--scrollbar-thumb-color-hover);
+}
+
+/* Scrollbar's increment/decrement buttons (repurposed as a scrollbar start/end gap) */
+
+::-webkit-scrollbar-button:vertical {
+ height: var(--scrollbar-start-end-gap);
+}
+
+::-webkit-scrollbar-button:horizontal {
+ width: var(--scrollbar-start-end-gap);
+}
\ No newline at end of file