Skip to content

Build your personal knowledge base with Trilium Notes

feat(share): give links in shared notes the modern theme's colors and look

Elian Doran3d408c2b466f
diff --git a/packages/share-theme/src/base.css b/packages/share-theme/src/base.css
index bdf791d933..6f47b6d163 100644
--- a/packages/share-theme/src/base.css
+++ b/packages/share-theme/src/base.css
@@ -25,7 +25,10 @@ html.theme-light {
--text-primary: #000000;
--text-heading: #000000;
--text-menu: #333333;
- --text-link: #0000ff;
+ /* The link colors of `theme-next-light.css`. */
+ --text-link: #0076af;
+ --link-hover-background: #3c7fa017;
+ --link-focus-outline-color: #00000063;
--text-menu-active: var(--background-secondary);
--mermaid-theme: default;
color-scheme: light;
@@ -39,7 +42,10 @@ html.theme-dark {
--text-primary: #cccccc;
--text-heading: #cccccc;
--text-menu: #AAAAAA;
- --text-link: #87CEFA;
+ /* The link colors of `theme-next-dark.css`. */
+ --text-link: #95c3d9;
+ --link-hover-background: #75c2e324;
+ --link-focus-outline-color: #ffffff57;
--text-menu-active: var(--background-secondary);
--mermaid-theme: dark;
color-scheme: dark;
diff --git a/packages/share-theme/src/content/content.css b/packages/share-theme/src/content/content.css
index 39329f67cd..8a75cfce60 100644
--- a/packages/share-theme/src/content/content.css
+++ b/packages/share-theme/src/content/content.css
@@ -64,6 +64,39 @@ iframe.pdf-view {
border-bottom: 1px solid var(--background-highlight);
}
+/* The links of the app's default theme, `theme-next/forms.css`; link previews have their own. */
+.ck-content a:where(:not(.link-embed-mention, .link-embed-card)) {
+ --background: transparent;
+
+ box-shadow: 0 0 0 0 var(--background);
+ border-radius: 4px;
+ background: var(--background);
+ font-weight: 500;
+ text-decoration: none;
+
+ transition:
+ background-color 200ms ease-out,
+ box-shadow 200ms ease-out,
+ color 300ms ease-out;
+}
+
+.ck-content a:where(:not(.link-embed-mention, .link-embed-card)):focus-visible {
+ outline: 2px solid var(--link-focus-outline-color);
+ outline-offset: 2px;
+}
+
+.ck-content a:where(:not(.link-embed-mention, .link-embed-card)):hover {
+ --background: var(--link-hover-background);
+
+ box-shadow: 0 0 0 4px var(--link-hover-background);
+ text-decoration: underline;
+
+ transition:
+ background-color 100ms ease-in,
+ box-shadow 100ms ease-in,
+ color 150ms ease-in;
+}
+
#content img {
max-width: 100%;
height: auto;