Skip to content

Commit 996a477

Browse files
committed
fix code block style
1 parent 5bd5c31 commit 996a477

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

theme/css/code.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,29 @@ code{
3939
font-size: 18px; border-bottom: 1px solid #fafafa; line-height: 23.4px;
4040
position: absolute; right: 25px; margin-top: 15px; color: #fff !important;
4141
}
42+
43+
/* ===== Lock <pre> / block-code colors (same in light & dark) ===== */
44+
45+
/* Choose a single text color that matches your fixed pre background */
46+
:root{
47+
--pre-fg-locked: #e6edf3; /* good for a dark pre background */
48+
/* if your pre background is light, use something like: #111 */
49+
}
50+
51+
/* Block code only (does NOT touch inline `code`) */
52+
pre,
53+
pre.output,
54+
pre code,
55+
pre.output code,
56+
.highlight pre,
57+
.highlight code {
58+
color: var(--pre-fg-locked) !important;
59+
}
60+
61+
/* Extra specificity so theme toggles can’t override */
62+
[data-bs-theme="light"] pre,
63+
[data-bs-theme="dark"] pre,
64+
[data-bs-theme="light"] pre code,
65+
[data-bs-theme="dark"] pre code {
66+
color: var(--pre-fg-locked) !important;
67+
}

0 commit comments

Comments
 (0)