feat: add Mermaid chart styles
This commit is contained in:
348
style.css
348
style.css
@@ -908,6 +908,105 @@ article .wp-block-separator {
|
||||
|
||||
}
|
||||
|
||||
/* ---------- Mermaid 图表容器样式 ---------- */
|
||||
.mermaid-container {
|
||||
background: var(--color-foreground);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
overflow-x: auto;
|
||||
max-width: 100%;
|
||||
opacity: 0;
|
||||
animation: mermaidFadeIn 0.3s ease-in-out forwards;
|
||||
}
|
||||
|
||||
.mermaid-container svg {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Mermaid 淡入动画 */
|
||||
@keyframes mermaidFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(10px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* 文章卡片内的 Mermaid 图表 */
|
||||
article.card .mermaid-container {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
/* Mermaid 错误提示样式 */
|
||||
.mermaid-error-container {
|
||||
background: rgba(220, 53, 69, 0.1);
|
||||
border: 1px solid rgba(220, 53, 69, 0.3);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-icon {
|
||||
font-size: 24px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #dc3545;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-body {
|
||||
margin-bottom: 12px;
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-type,
|
||||
.mermaid-error-container .error-message,
|
||||
.mermaid-error-container .error-line {
|
||||
margin: 6px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-code {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-code summary {
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
color: #721c24;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-code pre {
|
||||
margin-top: 10px;
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
padding: 12px;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.mermaid-error-container .error-code code {
|
||||
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
|
||||
width: 10px;
|
||||
@@ -16483,4 +16582,251 @@ article img.loaded, .post-thumbnail img.loaded, article img:not([loading="lazy"]
|
||||
@media print {
|
||||
*, *::before, *::after { animation: none !important; transition: none !important; }
|
||||
}
|
||||
/* ========== End of Modern UI Enhancements ========== */
|
||||
/* ========== End of Modern UI Enhancements ========== */
|
||||
|
||||
|
||||
/* ---------- Mermaid 夜间模式样式 ---------- */
|
||||
html.darkmode .mermaid-container {
|
||||
background: var(--color-widgets);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-container {
|
||||
background: rgba(220, 53, 69, 0.2);
|
||||
border-color: rgba(220, 53, 69, 0.4);
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-container .error-title {
|
||||
color: #ff6b7a;
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-container .error-body {
|
||||
color: #ffb3ba;
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-container .error-code summary {
|
||||
color: #ffb3ba;
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-container .error-code pre {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-container .error-code code {
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
|
||||
/* ==========================================================================
|
||||
Mermaid 图表样式
|
||||
========================================================================== */
|
||||
|
||||
/* ---------- Mermaid 容器基础样式 ---------- */
|
||||
.mermaid-container {
|
||||
background: var(--card-background);
|
||||
border-radius: var(--card-radius);
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
overflow-x: auto;
|
||||
max-width: 100%;
|
||||
transition: opacity 0.3s ease-in;
|
||||
}
|
||||
|
||||
.mermaid-container svg {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* ---------- 卡片内的 Mermaid 图表 ---------- */
|
||||
.card .mermaid-container,
|
||||
.post-card .mermaid-container,
|
||||
.comment-content .mermaid-container {
|
||||
padding: 15px;
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
/* ---------- 夜间模式适配 ---------- */
|
||||
html.darkmode .mermaid-container {
|
||||
background: var(--card-background-dark);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
/* ---------- 响应式设计 ---------- */
|
||||
@media screen and (max-width: 768px) {
|
||||
.mermaid-container {
|
||||
padding: 15px;
|
||||
margin: 15px 0;
|
||||
border-radius: calc(var(--card-radius) * 0.8);
|
||||
}
|
||||
|
||||
.mermaid-container svg {
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 480px) {
|
||||
.mermaid-container {
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- Mermaid 错误提示样式 ---------- */
|
||||
.mermaid-error-container {
|
||||
background: #fff5f5;
|
||||
border: 1px solid #fc8181;
|
||||
border-radius: var(--card-radius);
|
||||
padding: 20px;
|
||||
margin: 20px 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
|
||||
.mermaid-error-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.mermaid-error-icon {
|
||||
font-size: 24px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.mermaid-error-title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: #c53030;
|
||||
}
|
||||
|
||||
.mermaid-error-body {
|
||||
margin-bottom: 15px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.mermaid-error-type {
|
||||
font-weight: bold;
|
||||
color: #742a2a;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.mermaid-error-message {
|
||||
color: #742a2a;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.mermaid-error-code {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.mermaid-error-code summary {
|
||||
cursor: pointer;
|
||||
color: var(--themecolor);
|
||||
font-weight: bold;
|
||||
padding: 5px 0;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.mermaid-error-code summary:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.mermaid-error-code pre {
|
||||
background: #2d3748;
|
||||
color: #e2e8f0;
|
||||
padding: 15px;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
margin-top: 10px;
|
||||
font-family: 'Courier New', Consolas, Monaco, monospace;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.mermaid-error-code code {
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* ---------- 夜间模式下的错误提示 ---------- */
|
||||
html.darkmode .mermaid-error-container {
|
||||
background: #2d1f1f;
|
||||
border-color: #9b2c2c;
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-title {
|
||||
color: #fc8181;
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-type,
|
||||
html.darkmode .mermaid-error-message {
|
||||
color: #feb2b2;
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-error-code pre {
|
||||
background: #1a202c;
|
||||
color: #cbd5e0;
|
||||
}
|
||||
|
||||
/* ---------- 打印样式 ---------- */
|
||||
@media print {
|
||||
.mermaid-container {
|
||||
box-shadow: none;
|
||||
border: 1px solid #e2e8f0;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
.mermaid-error-container {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 加载动画 ---------- */
|
||||
.mermaid-container.loading {
|
||||
opacity: 0.5;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.mermaid-container.loading::after {
|
||||
content: "正在渲染图表...";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* ---------- 滚动条样式(Webkit) ---------- */
|
||||
.mermaid-container::-webkit-scrollbar {
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.mermaid-container::-webkit-scrollbar-track {
|
||||
background: var(--color-background);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.mermaid-container::-webkit-scrollbar-thumb {
|
||||
background: var(--color-border);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.mermaid-container::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-container::-webkit-scrollbar-track {
|
||||
background: var(--color-background-dark);
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-container::-webkit-scrollbar-thumb {
|
||||
background: var(--color-border-dark);
|
||||
}
|
||||
|
||||
html.darkmode .mermaid-container::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--color-text-secondary-dark);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user