Skip to content

Commit e38be69

Browse files
committed
fix(site): rewrite the theme of code highlight
1 parent b76c76d commit e38be69

File tree

2 files changed

+108
-3
lines changed

2 files changed

+108
-3
lines changed

examples/sites/src/assets/custom-markdown.css

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ body .markdown-body {
9797
}
9898
.markdown-body code {
9999
text-shadow: none !important;
100+
font-size: 120%;
101+
font-family: Consolas, 'Courier New', monospace !important;
100102
}
101103

102104
html.dark.dark .markdown-body {
@@ -115,6 +117,63 @@ html.dark.dark .markdown-body code .token.operator {
115117
background-color: transparent;
116118
}
117119

118-
html.dark.dark .markdown-body code .hljs-string {
119-
color: #6f42c1;
120+
/* 指南中的代码块高亮 */
121+
html.dark.dark .markdown-body code {
122+
&.language-bash {
123+
color: #9ecbff;
124+
.function {
125+
color: #b392f0;
126+
}
127+
}
128+
129+
&.language-js,
130+
&.language-javascript {
131+
color: #e1e4e8;
132+
.punctuation {
133+
color: #e1e4e8;
134+
}
135+
.keyword {
136+
color: #f97583;
137+
}
138+
.string {
139+
color: #9ecbff;
140+
}
141+
.function {
142+
color: #b392f0;
143+
}
144+
.literal-property,
145+
.property {
146+
color: #b392f0;
147+
}
148+
.operator {
149+
color: #e1e4e8;
150+
}
151+
.constant {
152+
color: #e1e4e8;
153+
}
154+
}
155+
156+
&.language-html {
157+
color: #e1e4e8;
158+
.tag {
159+
color: #85e89d;
160+
}
161+
.punctuation {
162+
color: #e1e4e8;
163+
}
164+
.attr-name {
165+
color: #f97583;
166+
}
167+
.attr-value {
168+
color: #9ecbff;
169+
}
170+
.literal-property,
171+
.string-property,
172+
.property {
173+
color: #b392f0;
174+
}
175+
.string {
176+
color: #9ecbff;
177+
}
178+
}
120179
}

examples/sites/src/views/components-doc/components/async-highlight.vue

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,59 @@ export default defineComponent({
5858
</script>
5959

6060
<style lang="less">
61+
/* 代码预览中的代码块高亮 */
62+
.dark {
63+
.code-preview-box {
64+
.hljs-tag {
65+
color: #e1e4e8;
66+
.hljs-name {
67+
color: #85e89d;
68+
}
69+
.hljs-attr {
70+
color: #b392f0;
71+
}
72+
.hljs-string {
73+
color: #9ecbff;
74+
}
75+
}
76+
77+
.language-javascript {
78+
color: #79b8ff;
79+
80+
.hljs-keyword,
81+
.hljs-title {
82+
color: #f97583;
83+
}
84+
.hljs-string {
85+
color: #9ecbff;
86+
}
87+
.hljs-attr {
88+
color: #e1e4e8;
89+
}
90+
.hljs-variable {
91+
color: #b392f0;
92+
}
93+
}
94+
.language-css {
95+
.hljs-selector-class {
96+
color: #b392f0;
97+
}
98+
.hljs-attribute {
99+
color: #9ecbff;
100+
}
101+
.hljs-number {
102+
color: #e1e4e8;
103+
}
104+
}
105+
}
106+
}
61107
.code-preview-box {
62108
max-height: 400px;
63109
overflow-y: auto;
64110
65111
pre {
66112
line-height: 22px;
67-
font-family: monospace;
113+
font-family: Consolas, 'Courier New', monospace !important;
68114
font-size: 14px;
69115
font-weight: 400;
70116
padding: 0px 12px;

0 commit comments

Comments
 (0)