hugo-theme-next/assets/css/_common/scaffolding/highlight/copy-code.scss

189 lines
6.5 KiB
SCSS

.highlight {
background: var(--highlight-background);
margin-bottom: 26px;
line-height: 1.25;
> .chroma {
position: relative;
pre {
padding: .45rem 0;
}
.lntd:first-child {
min-width: 1.6rem;
text-align: right;
background-color: #272822;
a {
border-bottom: none;
}
}
.lntd:last-child {
width: 100%;
pre {
overflow-wrap: break-word;
white-space: pre-wrap;
line-break: anywhere;
word-break: break-all;
overflow-x: auto;
}
}
> code > span {
overflow-wrap: break-word;
white-space: pre-wrap;
line-break: anywhere;
word-break: break-all;
}
}
/** monokai highlight style **/
/* Background */ .bg { color:#f8f8f2;background-color:#272822; }
/* PreWrapper */ .chroma { color:#f8f8f2;background-color:#272822; }
/* Other */ .chroma .x { }
/* Error */ .chroma .err { color:#960050;background-color:#1e0010 }
/* CodeLine */ .chroma .cl { }
/* LineLink */ .chroma .lnlinks { outline:none;text-decoration:none;color:inherit }
/* LineTableTD */ .chroma .lntd { vertical-align:top;padding:0;margin:0;border:0; }
/* LineTable */ .chroma .lntable { border-spacing:0;padding:0;margin:0;border:0; }
/* LineHighlight */ .chroma .hl { background-color:#3c3d38 }
/* LineNumbersTable */ .chroma .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f }
/* LineNumbers */ .chroma .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f }
/* Line */ .chroma .line { display:flex; }
/* Keyword */ .chroma .k { color:#66d9ef }
/* KeywordConstant */ .chroma .kc { color:#66d9ef }
/* KeywordDeclaration */ .chroma .kd { color:#66d9ef }
/* KeywordNamespace */ .chroma .kn { color:#f92672 }
/* KeywordPseudo */ .chroma .kp { color:#66d9ef }
/* KeywordReserved */ .chroma .kr { color:#66d9ef }
/* KeywordType */ .chroma .kt { color:#66d9ef }
/* Name */ .chroma .n { }
/* NameAttribute */ .chroma .na { color:#a6e22e }
/* NameBuiltin */ .chroma .nb { }
/* NameBuiltinPseudo */ .chroma .bp { }
/* NameClass */ .chroma .nc { color:#a6e22e }
/* NameConstant */ .chroma .no { color:#66d9ef }
/* NameDecorator */ .chroma .nd { color:#a6e22e }
/* NameEntity */ .chroma .ni { }
/* NameException */ .chroma .ne { color:#a6e22e }
/* NameFunction */ .chroma .nf { color:#a6e22e }
/* NameFunctionMagic */ .chroma .fm { }
/* NameLabel */ .chroma .nl { }
/* NameNamespace */ .chroma .nn { }
/* NameOther */ .chroma .nx { color:#a6e22e }
/* NameProperty */ .chroma .py { }
/* NameTag */ .chroma .nt { color:#f92672 }
/* NameVariable */ .chroma .nv { }
/* NameVariableClass */ .chroma .vc { }
/* NameVariableGlobal */ .chroma .vg { }
/* NameVariableInstance */ .chroma .vi { }
/* NameVariableMagic */ .chroma .vm { }
/* Literal */ .chroma .l { color:#ae81ff }
/* LiteralDate */ .chroma .ld { color:#e6db74 }
/* LiteralString */ .chroma .s { color:#e6db74 }
/* LiteralStringAffix */ .chroma .sa { color:#e6db74 }
/* LiteralStringBacktick */ .chroma .sb { color:#e6db74 }
/* LiteralStringChar */ .chroma .sc { color:#e6db74 }
/* LiteralStringDelimiter */ .chroma .dl { color:#e6db74 }
/* LiteralStringDoc */ .chroma .sd { color:#e6db74 }
/* LiteralStringDouble */ .chroma .s2 { color:#e6db74 }
/* LiteralStringEscape */ .chroma .se { color:#ae81ff }
/* LiteralStringHeredoc */ .chroma .sh { color:#e6db74 }
/* LiteralStringInterpol */ .chroma .si { color:#e6db74 }
/* LiteralStringOther */ .chroma .sx { color:#e6db74 }
/* LiteralStringRegex */ .chroma .sr { color:#e6db74 }
/* LiteralStringSingle */ .chroma .s1 { color:#e6db74 }
/* LiteralStringSymbol */ .chroma .ss { color:#e6db74 }
/* LiteralNumber */ .chroma .m { color:#ae81ff }
/* LiteralNumberBin */ .chroma .mb { color:#ae81ff }
/* LiteralNumberFloat */ .chroma .mf { color:#ae81ff }
/* LiteralNumberHex */ .chroma .mh { color:#ae81ff }
/* LiteralNumberInteger */ .chroma .mi { color:#ae81ff }
/* LiteralNumberIntegerLong */ .chroma .il { color:#ae81ff }
/* LiteralNumberOct */ .chroma .mo { color:#ae81ff }
/* Operator */ .chroma .o { color:#f92672 }
/* OperatorWord */ .chroma .ow { color:#f92672 }
/* Punctuation */ .chroma .p { }
/* Comment */ .chroma .c { color:#75715e }
/* CommentHashbang */ .chroma .ch { color:#75715e }
/* CommentMultiline */ .chroma .cm { color:#75715e }
/* CommentSingle */ .chroma .c1 { color:#75715e }
/* CommentSpecial */ .chroma .cs { color:#75715e }
/* CommentPreproc */ .chroma .cp { color:#75715e }
/* CommentPreprocFile */ .chroma .cpf { color:#75715e }
/* Generic */ .chroma .g { }
/* GenericDeleted */ .chroma .gd { color:#f92672 }
/* GenericEmph */ .chroma .ge { font-style:italic }
/* GenericError */ .chroma .gr { }
/* GenericHeading */ .chroma .gh { }
/* GenericInserted */ .chroma .gi { color:#a6e22e }
/* GenericOutput */ .chroma .go { }
/* GenericPrompt */ .chroma .gp { }
/* GenericStrong */ .chroma .gs { font-weight:bold }
/* GenericSubheading */ .chroma .gu { color:#75715e }
/* GenericTraceback */ .chroma .gt { }
/* GenericUnderline */ .chroma .gl { }
/* TextWhitespace */ .chroma .w { }
}
@if $codeblock_copy_btn_enable {
.highlight:hover .copy-btn, pre:hover .copy-btn {
opacity: 1;
}
.copy-btn {
color: $black-dim;
cursor: pointer;
line-height: 1.6;
opacity: 0;
padding: 2px 6px;
position: absolute;
right: 8px;
top: 4px;
transition: opacity $transition-ease;
background: var(--highlight-background);
@if $codeblock_style == 'flat' {
background: white;
border: 0;
font-size: $font-size-smaller;
} @else if $codeblock_style == 'mac' {
color: var(--highlight-foreground);
font-size: 14px;
border-radius: 3px;
} @else {
background-color: $gainsboro;
background-image: linear-gradient(#fcfcfc, $gainsboro);
border: 1px solid #d5d5d5;
border-radius: 3px;
font-size: $font-size-smaller;
}
}
}
@if $codeblock_style == 'mac' {
.highlight {
border-radius: 5px;
box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4);
padding-top: 30px;
> div {
&::before {
background: #fc625d;
box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
margin-top: -20px;
margin-left: 10px;
position: absolute;
@include round-icon(12px);
}
}
}
}