Skip to content

Commit 5043e7f

Browse files
committed
feat: add markdown buttons styles to VitePress theme
1 parent b15fb83 commit 5043e7f

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

.vitepress/theme/styles/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@import "./inline-demo.css";
55
@import "./utilities.css";
66
@import "./style-guide.css";
7+
@import "./markdown-buttons.css";
78

89
.VPHero .main {
910
padding: 60px 0;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Component: Markdown Copy Buttons
3+
* -------------------------------------------------------------------------- */
4+
5+
/* 重置 markdown-copy-buttons 的 hover 样式,使用主题色 */
6+
.markdown-copy-buttons button {
7+
padding: 8px 16px;
8+
border: 1px solid var(--vp-c-divider);
9+
background-color: var(--vp-c-bg);
10+
color: var(--vp-c-text-1);
11+
font-weight: 500;
12+
}
13+
14+
.markdown-copy-buttons button:hover {
15+
border-color: var(--vp-c-brand);
16+
background-color: var(--vp-c-brand);
17+
color: var(--vp-c-white);
18+
}
19+
20+
.markdown-copy-buttons button:active {
21+
border-color: var(--vp-c-brand-dark);
22+
background-color: var(--vp-c-brand-dark);
23+
color: var(--vp-c-white);
24+
}
25+
26+
/* 深色模式下的样式调整 */
27+
.dark .markdown-copy-buttons button {
28+
border-color: var(--vp-c-divider);
29+
background-color: var(--vp-c-bg-alt);
30+
color: var(--vp-c-text-1);
31+
}
32+
33+
.dark .markdown-copy-buttons button:hover {
34+
border-color: var(--vp-c-brand-light);
35+
background-color: var(--vp-c-brand-light);
36+
color: var(--vp-c-white);
37+
}
38+
39+
.dark .markdown-copy-buttons button:active {
40+
border-color: var(--vp-c-brand);
41+
background-color: var(--vp-c-brand);
42+
color: var(--vp-c-white);
43+
}

0 commit comments

Comments
 (0)