159 lines
3.2 KiB
CSS
159 lines
3.2 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: oklch(85% 0.139 37.8);
|
|
}
|
|
.token.comment,
|
|
.token.doctype,
|
|
.token.prolog {
|
|
font-weight: 700;
|
|
opacity: 0.75;
|
|
}
|
|
.token.deleted,
|
|
.token.entity,
|
|
.token.selector,
|
|
.token.tag,
|
|
.token.url,
|
|
.token.variable {
|
|
color: oklch(85% 0.275 23.2);
|
|
}
|
|
.token.number,
|
|
.token.unit {
|
|
color: oklch(85% 0.201 37.8);
|
|
}
|
|
.token.attr-name,
|
|
.token.builtin,
|
|
.token.class {
|
|
color: oklch(85% 0.128 81.1);
|
|
}
|
|
.token.class-name,
|
|
.token.hexcode,
|
|
.token.regex {
|
|
color: oklch(85% 0.214 113.5);
|
|
}
|
|
.token.attr-value,
|
|
.token.attribute,
|
|
.token.pseudo-class,
|
|
.token.pseudo-element,
|
|
.token.string {
|
|
color: oklch(85% 0.201 129.4);
|
|
}
|
|
.token.cdata,
|
|
.token.char,
|
|
.token.inserted,
|
|
.token.property {
|
|
color: oklch(85% 0.075 188.2);
|
|
}
|
|
.token.operator,
|
|
.token.punctuation {
|
|
color: oklch(85% 0.094 225.9);
|
|
}
|
|
.token.atrule,
|
|
.token.boolean,
|
|
.token.constant,
|
|
.token.function,
|
|
.token.id,
|
|
.token.important,
|
|
.token.keyword,
|
|
.token.symbol {
|
|
color: oklch(85% 0.214 311.1);
|
|
}
|
|
}
|