jldiaz_copy-protocol-plugin/styles.css
2026-05-13 21:38:18 +02:00

74 lines
2.3 KiB
CSS

/*
* Visual indicator for obsidian://copy protocol links.
*/
/* ── Reading View (Standard Links) ── */
a[href^="obsidian://copy"]::after {
content: "";
display: inline-block;
width: 0.85em;
height: 0.85em;
margin-left: 5px;
vertical-align: middle;
background-color: currentColor;
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E");
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E");
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
opacity: 0.8;
}
a[href^="obsidian://copy"]:hover::after {
opacity: 1;
}
/* ── Live Preview (Managed by ViewPlugin Widget) ── */
/*
* Hide Obsidian's default external link icon on the same line as our copy links.
* We still use the .copy-protocol-link mark for this.
*/
.cm-line:has(.copy-protocol-link) .external-link,
.cm-line:has(.copy-protocol-link) .cm-url.external-link,
.cm-line:has(.copy-protocol-link) .cm-widgetBuffer + .external-link {
display: none !important;
}
/* Ensure the link text looks like a link */
.copy-protocol-link {
text-decoration: underline;
text-underline-offset: 2px;
}
/* Copy cursor on hover */
.copy-protocol-link:hover,
a[href^="obsidian://copy"]:hover {
cursor: copy !important;
}
/* ── Widget Styles (Live Preview) ── */
.copy-protocol-icon {
cursor: copy;
display: inline-flex;
margin-left: 5px;
vertical-align: middle;
opacity: 0.8;
transition: transform 0.1s ease-out, opacity 0.1s ease-out;
}
.copy-protocol-icon:hover {
opacity: 1;
}
.copy-protocol-icon svg {
width: 0.85em;
height: 0.85em;
}
.copy-protocol-icon.is-clicked {
transform: scale(1.2);
}