joshua.seigler.net/site/_includes/css/prism.css
2025-07-11 00:51:25 -04:00

124 lines
3.4 KiB
CSS

/* Prism Material with some adjustments */
code[class*="language-"],
pre[class*="language-"] {
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
font-size: 0.8rem;
line-height: 1.4;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
:not(pre) > code[class*="language-"] {
background: var(--c-text-background-light);
white-space: normal;
border-radius: 0.2rem;
padding: 0.1em;
}
pre[class*="language-"] {
background: color-mix(in lch, var(--c-text-background-light) 20%, transparent);
> code {
white-space: pre-wrap;
word-break: break-all;
}
position: relative;
margin: 0.5em 0;
padding: 0.5em 1em 0.5em calc(var(--lineNumWidth) + 0.25rem);
box-shadow: inset 0 0 6rem -2rem var(--c-highlight);
counter-reset: lineNumber;
--places: 1;
&:has(.highlight-line:nth-child(10)) { --places: 2 }
&:has(.highlight-line:nth-child(100)) { --places: 3 }
&:has(.highlight-line:nth-child(1000)) { --places: 4 }
--lineNumWidth: calc(1em + var(--places) * 1ch);
&::before {
content: '';
position: absolute;
height: 100%;
top: 0;
left: var(--lineNumWidth);
width: 3rem;
opacity: 0.125;
z-index: -1;
background: linear-gradient(to right, var(--c-highlight), transparent);
border-radius: 0.5em;
}
.highlight-line {
position: relative;
}
.highlight-line::before {
content: counter(lineNumber);
counter-increment: lineNumber;
position: absolute;
top: 0;
right: calc(100% + 0.5em);
color: var(--c-highlight);
word-break: normal;
}
}
p:has(+ pre[class*="language-"]) > code {
margin: 0;
padding: 0.1em 1em;
border-radius: none;
background: none;
}
p:has(>code) + pre[class*="language-"] {
margin-top: 0;
}
[class*="language-"] .namespace {
opacity: 0.7;
}
.token.id { font-weight: bold; }
.token.important { font-weight: bold; }
@media screen {
pre[class*="language-"] { color: var(--c-text-dim); }
.language-css > code,
.language-sass > code,
.language-scss > code {
color: #fd9170;
}
.token.atrule { color: #c792ea; }
.token.attr-name { color: #ffcb6b; }
.token.attr-value { color: #a5e844; }
.token.attribute { color: #a5e844; }
.token.boolean { color: #c792ea; }
.token.builtin { color: #ffcb6b; }
.token.cdata { color: #80cbc4; }
.token.char { color: #80cbc4; }
.token.class { color: #ffcb6b; }
.token.class-name { color: #f2ff00; }
.token.comment { color: #616161; }
.token.constant { color: #c792ea; }
.token.deleted { color: #ff6666; }
.token.doctype { color: #616161; }
.token.entity { color: #ff6666; }
.token.function { color: #c792ea; }
.token.hexcode { color: #f2ff00; }
.token.id { color: #c792ea; }
.token.important { color: #c792ea; }
.token.inserted { color: #80cbc4; }
.token.keyword { color: #c792ea; }
.token.number { color: #fd9170; }
.token.operator { color: #89ddff; }
.token.prolog { color: #616161; }
.token.property { color: #80cbc4; }
.token.pseudo-class { color: #a5e844; }
.token.pseudo-element { color: #a5e844; }
.token.punctuation { color: #89ddff; }
.token.regex { color: #f2ff00; }
.token.selector { color: #ff6666; }
.token.string { color: #a5e844; }
.token.symbol { color: #c792ea; }
.token.tag { color: #ff6666; }
.token.unit { color: #fd9170; }
.token.url { color: #ff6666; }
.token.variable { color: #ff6666; }
}