simon-einzinger.de/docs/.vitepress/theme/styles/code.css
2025-01-29 22:02:53 +01:00

164 lines
3.8 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[data-theme="light"] .shiki .line [style*="--shiki-light:"] {
color: var(--shiki-light) !important;
}
[data-theme="dark"] .shiki .line [style*="--shiki-dark:"] {
color: var(--shiki-dark) !important;
}
.vp-code-group.vp-adaptive-theme,
.vp-code-block-title {
margin: 1.5em 0;
border: 1px solid var(--outline-color);
border-radius: 6px;
background-color: var(--background-color);
overflow: hidden;
}
.vp-code-block-title-bar {
margin: 0;
}
.vp-code-group.vp-adaptive-theme .tabs {
display: flex;
border-bottom: 1px solid var(--outline-color);
background-color: var(--background-color);
}
.vp-code-group.vp-adaptive-theme .tabs input {
display: none;
}
/* Each label acts like a tab */
.vp-code-group.vp-adaptive-theme .tabs label {
margin: 0;
padding: 0.6em 1em;
font-size: 0.9rem;
cursor: pointer;
user-select: none;
border-right: 1px solid var(--outline-color);
color: var(--text-color);
transition:
background-color 0.2s,
color 0.2s;
}
/* Hover effect for a tab */
.vp-code-group.vp-adaptive-theme .tabs label:hover {
background-color: rgba(0, 0, 0, 0.05);
}
/* The "checked" tab => active style */
.vp-code-group.vp-adaptive-theme .tabs input:checked + label {
background-color: var(--primary-color);
color: #fff;
font-weight: bold;
border-right-color: var(--primary-color);
}
/* The container for each code block */
.vp-code-group.vp-adaptive-theme .blocks {
position: relative;
}
/* Hide all code blocks except the one with .active */
.vp-code-group.vp-adaptive-theme .blocks > div:not(.active) {
display: none;
}
/* Show the active one */
.vp-code-group.vp-adaptive-theme .blocks > .active {
display: block;
}
[class^="language-"] {
border: 1px solid var(--outline-color);
border-radius: 6px;
}
.vp-code-group [class^="language-"],
.vp-code-block-title [class^="language-"] {
border: 0;
}
/* Vertical line above language- in .vp-code-block-title */
.vp-code-block-title [class^="language-"] {
border-top: 1px solid var(--outline-color);
}
[class^="language-"].vp-adaptive-theme {
position: relative;
background-color: var(--background-color);
overflow: hidden;
transition: background-color 0.2s;
}
.shiki.vp-code {
margin: 0;
padding: 1em;
font-family: "Fira Code", monospace;
font-size: 0.9rem;
line-height: 0.75;
overflow: auto;
}
.shiki .line {
display: block;
white-space: pre;
}
/* Language label (e.g. “sh”, “py”), top-right by default */
[class^="language-"].vp-adaptive-theme .lang {
position: absolute;
top: 0.4em;
right: 0.6em;
padding: 0.1em 0.5em;
font-size: 0.75rem;
color: var(--secondary-text-color);
opacity: 1;
transition: opacity 0.2s;
}
/* Copy button.
Note that after copying, VitePress might change the class to “copied code”.
So lets target BOTH .copy and .copied.code. */
[class^="language-"].vp-adaptive-theme .copy,
[class^="language-"].vp-adaptive-theme .copied {
position: absolute;
top: 0.4em;
right: 0.6em;
background: transparent;
border: none;
font-size: 0.75rem;
padding: 0.1em 0.5em;
border-radius: 3px;
cursor: pointer;
opacity: 0;
pointer-events: none;
color: var(--secondary-text-color);
transition:
opacity 0.2s,
background-color 0.2s;
}
[class^="language-"].vp-adaptive-theme .copy:after {
content: "Copy";
}
[class^="language-"].vp-adaptive-theme .copied:after {
content: "Copied";
}
[class^="language-"].vp-adaptive-theme:hover .lang {
opacity: 0;
pointer-events: none;
}
[class^="language-"].vp-adaptive-theme:hover .copy,
[class^="language-"].vp-adaptive-theme:hover .copied.code {
opacity: 1;
pointer-events: auto;
}
/* Hover effect on the button */
[class^="language-"].vp-adaptive-theme .copy:hover,
[class^="language-"].vp-adaptive-theme .copied.code:hover {
background-color: var(--outline-color);
color: var(--text-color);
}