Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(share): match the navigation tree to the app's modern theme
Elian Doranf7921cd905d3
diff --git a/packages/share-theme/src/base.css b/packages/share-theme/src/base.cssindex 311ffbb9ff..a3547a1894 100644--- a/packages/share-theme/src/base.css+++ b/packages/share-theme/src/base.css@@ -33,7 +33,10 @@ html.theme-light {/* The code colors of `theme-next-light.css`. */--code-block-box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.1), 0px 0px 2px rgba(0, 0, 0, 0.2);--inline-code-background-color: rgba(0, 0, 0, 0.05);- /* The tree item colors of `theme-next-light.css`. */+ /* The tree pane colors of `theme-next-light.css`. */+ --tree-background: #f2f2f2;+ --tree-item-color: #383838;+ --tree-item-icon-color: currentColor;--tree-item-hover-background: rgba(0, 0, 0, 0.032);--tree-item-active-background: #FFFFFF;--tree-item-active-color: #000000;@@ -74,7 +77,10 @@ html.theme-dark {/* The code colors of `theme-next-dark.css`. */--code-block-box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);--inline-code-background-color: rgba(255, 255, 255, 0.08);- /* The tree item colors of `theme-next-dark.css`. */+ /* The tree pane colors of `theme-next-dark.css`. */+ --tree-background: #1f1f1f;+ --tree-item-color: #aaaaaa;+ --tree-item-icon-color: #c5c5c5;--tree-item-hover-background: #ffffff0d;--tree-item-active-background: #ffffff25;--tree-item-active-color: #dfdfdf;diff --git a/packages/share-theme/src/page/layout.css b/packages/share-theme/src/page/layout.cssindex 21600f2071..8196be95cb 100644--- a/packages/share-theme/src/page/layout.css+++ b/packages/share-theme/src/page/layout.css@@ -27,7 +27,7 @@ html {width: var(--left-pane-width);height: 100vh;border-inline-end: 1px solid var(--background-highlight);- background: var(--background-secondary);+ background: var(--tree-background);justify-content: flex-start;position: sticky;top: 0;@@ -38,12 +38,12 @@ html {/* Extends the pane's background to the edge of the window when the layout is narrower than it. */@media not all and (max-width: 48em) {#left-pane {- box-shadow: -100vw 0 0 100vw var(--background-secondary);+ box-shadow: -100vw 0 0 100vw var(--tree-background);clip-path: inset(0 0 0 -100vw);}#left-pane:dir(rtl) {- box-shadow: 100vw 0 0 100vw var(--background-secondary);+ box-shadow: 100vw 0 0 100vw var(--tree-background);clip-path: inset(0 -100vw 0 0);}}diff --git a/packages/share-theme/src/page/navigation.css b/packages/share-theme/src/page/navigation.cssindex 517e4c5069..18fb472dc5 100644--- a/packages/share-theme/src/page/navigation.css+++ b/packages/share-theme/src/page/navigation.css@@ -3,7 +3,7 @@display: flex;flex-direction: column;- padding: 0 25px 25px;+ padding: 0 6px 40px;}/* Stays at the top of the pane while the tree scrolls, which fades out under its bottom edge. */@@ -14,11 +14,11 @@display: flex;flex-direction: column;gap: 20px;- margin-inline: -25px;+ margin-inline: -6px;padding: var(--page-top-spacing) 25px var(--site-header-fade);background: linear-gradient(to bottom,- var(--background-secondary) calc(100% - var(--site-header-fade)),+ var(--tree-background) calc(100% - var(--site-header-fade)),transparent);}@@ -50,7 +50,7 @@display: flex;flex-direction: column;list-style: none;- padding-inline-start: 12px;+ padding-inline-start: 10px;}#menu li {@@ -58,8 +58,6 @@display: flex;flex-direction: column;list-style: none;- cursor: pointer;- max-width: 350px;}#menu li > ul {@@ -74,11 +72,12 @@/* The tree items of the app's default theme (`theme-next/shell.css`, "TREE PANE"). `li > a` is therow of a `tree_item` partial copied from an earlier theme, whose button sits inside its link. */#menu :is(.tree-item-row, li > a) {+ position: relative;+ isolation: isolate;display: flex;flex: 1;border-radius: 6px;- color: var(--text-menu);- transition: background-color 150ms ease;+ color: var(--tree-item-color);}#menu :is(.tree-item-row, li > a):hover {@@ -86,9 +85,26 @@}#menu :is(.tree-item-row, li > a).active {+ background: transparent;+ color: var(--tree-item-active-color);+}++/* The current note's card, inset by 2px as the app's `--left-pane-item-selected-shadow-size`. */+#menu :is(.tree-item-row, li > a).active::before {+ content: "";+ position: absolute;+ inset: 2px;+ z-index: -1;+ border-radius: 6px;background: var(--tree-item-active-background);box-shadow: var(--tree-item-active-shadow);- color: var(--tree-item-active-color);+ animation: tree-item-select 200ms ease-out;+}++@keyframes tree-item-select {+ from {+ opacity: 0;+ }}#menu .tree-item-row {@@ -99,9 +115,9 @@display: flex;flex: 1;align-items: center;- gap: 6px;+ gap: 7px;min-width: 0;- padding: 7px 8px 7px 6px;+ padding: 7px 8px 7px 0;border-radius: 6px;color: inherit;font-weight: 400;@@ -109,7 +125,7 @@}#menu li.item > .tree-item-row > a {- padding-inline-start: 34px;+ padding-inline-start: 29px;}#menu li > a {@@ -127,8 +143,12 @@}#menu a > .tn-icon {+ display: flex;flex-shrink: 0;+ justify-content: center;+ width: 1em;font-size: 1.2em;+ color: var(--tree-item-icon-color);}#menu .tree-item-title {@@ -154,7 +174,7 @@}.tree-item-row > .collapse-button {- width: 28px;+ margin-inline-end: 5px;}.collapse-button:hover {@@ -185,9 +205,12 @@@media (prefers-reduced-motion: reduce) {#menu li > ul,- #menu :is(.tree-item-row, li > a),.collapse-button,.collapse-button > * {transition: none;}++ #menu :is(.tree-item-row, li > a).active::before {+ animation: none;+ }}