diff --git a/public/images/copy-svgrepo-com.svg b/public/images/copy-svgrepo-com.svg
new file mode 100644
index 0000000..39fbf5f
--- /dev/null
+++ b/public/images/copy-svgrepo-com.svg
@@ -0,0 +1,18 @@
+
+
+
\ No newline at end of file
diff --git a/public/images/correct-signal-svgrepo-com.svg b/public/images/correct-signal-svgrepo-com.svg
new file mode 100644
index 0000000..147f4f9
--- /dev/null
+++ b/public/images/correct-signal-svgrepo-com.svg
@@ -0,0 +1,12 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/components/FriendlyLinks/FriendsDescription.astro b/src/components/FriendlyLinks/FriendsDescription.astro
index 8c9342b..a1e2dad 100644
--- a/src/components/FriendlyLinks/FriendsDescription.astro
+++ b/src/components/FriendlyLinks/FriendsDescription.astro
@@ -64,6 +64,11 @@ avatar: 'https://s2.loli.net/2025/11/22/tiDKuzdqycx1v9B.png'
border-radius: 3px;
padding: 0rem;
overflow-x: auto;
+ /* color: var(--text-color); */
+ }
+
+ :global(.dark) .friend-code-block {
+ background: rgba(127, 127, 127, 0.12);
}
.friend-code-block pre {
diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro
index 5a2646d..28a9a0a 100644
--- a/src/layouts/BaseLayout.astro
+++ b/src/layouts/BaseLayout.astro
@@ -42,6 +42,65 @@ const {
{pageTitle}
+
diff --git a/src/styles/code.css b/src/styles/code.css
new file mode 100644
index 0000000..3fc3802
--- /dev/null
+++ b/src/styles/code.css
@@ -0,0 +1,86 @@
+pre {
+ padding: 1rem;
+ border-radius: 3px;
+ overflow-x: auto;
+ line-height: 1.6;
+ margin: 1rem 0;
+ position: relative;
+
+}
+
+/* pre:has(> .code-copy-button) {
+ padding-top: 2.75rem;
+} */
+
+code {
+ font-family: "Maple Mono", monospace;
+ font-size: 0.96rem;
+}
+
+/* 行内代码 */
+p code,
+li code,
+blockquote code,
+td code {
+ padding: 0.15em 0.4em;
+ border-radius: 0.25rem;
+ background: rgba(127, 127, 127, 0.12);
+}
+
+.code-copy-button {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ z-index: 2;
+
+ display: grid;
+ place-items: center;
+ width: 2rem;
+ height: 2rem;
+ padding: 0.35rem;
+
+ border-top: 1px dotted var(--deep-blue);
+ border-left: 1px dotted var(--deep-blue);
+ border-right: 2px solid var(--deep-blue);
+ border-bottom: 2px solid var(--deep-blue);
+ border-radius: 3px;
+
+ background: rgba(250, 250, 250, 0.7);
+ cursor: pointer;
+
+ transition:
+ transform 0.15s ease,
+ background-color 0.15s ease,
+ box-shadow 0.15s ease;
+}
+
+.code-copy-icon {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: contain;
+ pointer-events: none;
+}
+
+.code-copy-button:hover {
+ background: rgb(250, 250, 250, 0.9);
+ transform: translate(-1px, -1px);
+ box-shadow: 3px 4px 8px rgb(0 0 0 / 18%);
+}
+
+.code-copy-button:active {
+ transform: translate(0, 0);
+ box-shadow: none;
+}
+
+.code-copy-button.copied {
+ background: #dcebd5;
+}
+
+/* .dark .code-copy-button {
+ border-color: #9ecbff;
+}
+
+.dark .code-copy-button:hover {
+ box-shadow: 3px 4px 8px rgb(0 0 0 / 35%);
+} */
\ No newline at end of file
diff --git a/src/styles/global.css b/src/styles/global.css
index 041a567..5a144c6 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -5,29 +5,8 @@
@import "./variables.css";
@import "./dialog.css";
@import "./posts.css";
+@import "./code.css";
-pre {
- padding: 1rem;
- border-radius: 0.5rem;
- overflow-x: auto;
- line-height: 1.6;
- margin: 1rem 0;
-}
-
-code {
- font-family: "Maple Mono", monospace;
- font-size: 0.96rem;
-}
-
-/* 行内代码 */
-p code,
-li code,
-blockquote code,
-td code {
- padding: 0.15em 0.4em;
- border-radius: 0.25rem;
- background: rgba(127, 127, 127, 0.12);
-}
article svg.flowchart,
article svg[class*="flowchart"],
@@ -162,4 +141,4 @@ img {
max-width: 100%;
height: auto;
display: block;
-}
+}
\ No newline at end of file