Highlight.js -> Hugo's chromastyles (#1364)
* remove hljs * rename var --hljs-bg to --code-block-bg * bundle chroma-styles from css/includes/chroma-styles.css * add compatibility fixes for papermod <-> chroma * fix line-num and line padding and set width for line container to 100% * After a lot of experimentation this compatiblity should work well * fix inline line highlights not working * Use catppuccin-macchiato as default theme with highlightStyle 'bg:#474733' - hugo gen chromastyles --style catppuccin-macchiato --highlightStyle 'bg:#474733' > assets/css/includes/chroma-styles.css
This commit is contained in:
parent
a1cb044262
commit
045c08496d
|
@ -155,7 +155,7 @@
|
||||||
|
|
||||||
.post-content .highlight:not(table) {
|
.post-content .highlight:not(table) {
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
background: var(--hljs-bg) !important;
|
background: var(--code-block-bg) !important;
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
}
|
}
|
||||||
|
@ -199,11 +199,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content pre code {
|
.post-content pre code {
|
||||||
display: block;
|
display: grid;
|
||||||
margin: auto 0;
|
margin: auto 0;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
color: rgb(213, 213, 214);
|
color: rgb(213, 213, 214);
|
||||||
background: var(--hljs-bg) !important;
|
background: var(--code-block-bg) !important;
|
||||||
border-radius: var(--radius);
|
border-radius: var(--radius);
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
--secondary: rgb(108, 108, 108);
|
--secondary: rgb(108, 108, 108);
|
||||||
--tertiary: rgb(214, 214, 214);
|
--tertiary: rgb(214, 214, 214);
|
||||||
--content: rgb(31, 31, 31);
|
--content: rgb(31, 31, 31);
|
||||||
--hljs-bg: rgb(28, 29, 33);
|
--code-block-bg: rgb(28, 29, 33);
|
||||||
--code-bg: rgb(245, 245, 245);
|
--code-bg: rgb(245, 245, 245);
|
||||||
--border: rgb(238, 238, 238);
|
--border: rgb(238, 238, 238);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
--secondary: rgb(155, 156, 157);
|
--secondary: rgb(155, 156, 157);
|
||||||
--tertiary: rgb(65, 66, 68);
|
--tertiary: rgb(65, 66, 68);
|
||||||
--content: rgb(196, 196, 197);
|
--content: rgb(196, 196, 197);
|
||||||
--hljs-bg: rgb(46, 46, 51);
|
--code-block-bg: rgb(46, 46, 51);
|
||||||
--code-bg: rgb(55, 56, 62);
|
--code-bg: rgb(55, 56, 62);
|
||||||
--border: rgb(51, 51, 51);
|
--border: rgb(51, 51, 51);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,63 +0,0 @@
|
||||||
.hljs-comment,
|
|
||||||
.hljs-quote {
|
|
||||||
color: #b6b18b;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs-deletion,
|
|
||||||
.hljs-name,
|
|
||||||
.hljs-regexp,
|
|
||||||
.hljs-selector-class,
|
|
||||||
.hljs-selector-id,
|
|
||||||
.hljs-tag,
|
|
||||||
.hljs-template-variable,
|
|
||||||
.hljs-variable {
|
|
||||||
color: #eb3c54;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs-built_in,
|
|
||||||
.hljs-builtin-name,
|
|
||||||
.hljs-link,
|
|
||||||
.hljs-literal,
|
|
||||||
.hljs-meta,
|
|
||||||
.hljs-number,
|
|
||||||
.hljs-params,
|
|
||||||
.hljs-type {
|
|
||||||
color: #e7ce56;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs-attribute {
|
|
||||||
color: #ee7c2b;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs-addition,
|
|
||||||
.hljs-bullet,
|
|
||||||
.hljs-string,
|
|
||||||
.hljs-symbol {
|
|
||||||
color: #4fb4d7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs-section,
|
|
||||||
.hljs-title {
|
|
||||||
color: #78bb65;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs-keyword,
|
|
||||||
.hljs-selector-tag {
|
|
||||||
color: #b45ea4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs {
|
|
||||||
display: block;
|
|
||||||
overflow-x: auto;
|
|
||||||
background: #1c1d21;
|
|
||||||
color: #c0c5ce;
|
|
||||||
padding: .5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs-emphasis {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hljs-strong {
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
.chroma {
|
||||||
|
background-color: unset !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chroma .hl {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chroma .lnt {
|
||||||
|
padding: 0 0 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight pre.chroma code {
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight pre.chroma .line .cl,
|
||||||
|
.chroma .ln {
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chroma .lntd:last-of-type {
|
||||||
|
width: 100%;
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
/* Background */ .bg { color: #cad3f5; background-color: #24273a; }
|
||||||
|
/* PreWrapper */ .chroma { color: #cad3f5; background-color: #24273a; }
|
||||||
|
/* Other */ .chroma .x { }
|
||||||
|
/* Error */ .chroma .err { color: #ed8796 }
|
||||||
|
/* 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: #474733 }
|
||||||
|
/* 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: #8087a2 }
|
||||||
|
/* 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: #8087a2 }
|
||||||
|
/* Line */ .chroma .line { display: flex; }
|
||||||
|
/* Keyword */ .chroma .k { color: #c6a0f6 }
|
||||||
|
/* KeywordConstant */ .chroma .kc { color: #f5a97f }
|
||||||
|
/* KeywordDeclaration */ .chroma .kd { color: #ed8796 }
|
||||||
|
/* KeywordNamespace */ .chroma .kn { color: #8bd5ca }
|
||||||
|
/* KeywordPseudo */ .chroma .kp { color: #c6a0f6 }
|
||||||
|
/* KeywordReserved */ .chroma .kr { color: #c6a0f6 }
|
||||||
|
/* KeywordType */ .chroma .kt { color: #ed8796 }
|
||||||
|
/* Name */ .chroma .n { }
|
||||||
|
/* NameAttribute */ .chroma .na { color: #8aadf4 }
|
||||||
|
/* NameBuiltin */ .chroma .nb { color: #91d7e3 }
|
||||||
|
/* NameBuiltinPseudo */ .chroma .bp { color: #91d7e3 }
|
||||||
|
/* NameClass */ .chroma .nc { color: #eed49f }
|
||||||
|
/* NameConstant */ .chroma .no { color: #eed49f }
|
||||||
|
/* NameDecorator */ .chroma .nd { color: #8aadf4; font-weight: bold }
|
||||||
|
/* NameEntity */ .chroma .ni { color: #8bd5ca }
|
||||||
|
/* NameException */ .chroma .ne { color: #f5a97f }
|
||||||
|
/* NameFunction */ .chroma .nf { color: #8aadf4 }
|
||||||
|
/* NameFunctionMagic */ .chroma .fm { color: #8aadf4 }
|
||||||
|
/* NameLabel */ .chroma .nl { color: #91d7e3 }
|
||||||
|
/* NameNamespace */ .chroma .nn { color: #f5a97f }
|
||||||
|
/* NameOther */ .chroma .nx { }
|
||||||
|
/* NameProperty */ .chroma .py { color: #f5a97f }
|
||||||
|
/* NameTag */ .chroma .nt { color: #c6a0f6 }
|
||||||
|
/* NameVariable */ .chroma .nv { color: #f4dbd6 }
|
||||||
|
/* NameVariableClass */ .chroma .vc { color: #f4dbd6 }
|
||||||
|
/* NameVariableGlobal */ .chroma .vg { color: #f4dbd6 }
|
||||||
|
/* NameVariableInstance */ .chroma .vi { color: #f4dbd6 }
|
||||||
|
/* NameVariableMagic */ .chroma .vm { color: #f4dbd6 }
|
||||||
|
/* Literal */ .chroma .l { }
|
||||||
|
/* LiteralDate */ .chroma .ld { }
|
||||||
|
/* LiteralString */ .chroma .s { color: #a6da95 }
|
||||||
|
/* LiteralStringAffix */ .chroma .sa { color: #ed8796 }
|
||||||
|
/* LiteralStringBacktick */ .chroma .sb { color: #a6da95 }
|
||||||
|
/* LiteralStringChar */ .chroma .sc { color: #a6da95 }
|
||||||
|
/* LiteralStringDelimiter */ .chroma .dl { color: #8aadf4 }
|
||||||
|
/* LiteralStringDoc */ .chroma .sd { color: #6e738d }
|
||||||
|
/* LiteralStringDouble */ .chroma .s2 { color: #a6da95 }
|
||||||
|
/* LiteralStringEscape */ .chroma .se { color: #8aadf4 }
|
||||||
|
/* LiteralStringHeredoc */ .chroma .sh { color: #6e738d }
|
||||||
|
/* LiteralStringInterpol */ .chroma .si { color: #a6da95 }
|
||||||
|
/* LiteralStringOther */ .chroma .sx { color: #a6da95 }
|
||||||
|
/* LiteralStringRegex */ .chroma .sr { color: #8bd5ca }
|
||||||
|
/* LiteralStringSingle */ .chroma .s1 { color: #a6da95 }
|
||||||
|
/* LiteralStringSymbol */ .chroma .ss { color: #a6da95 }
|
||||||
|
/* LiteralNumber */ .chroma .m { color: #f5a97f }
|
||||||
|
/* LiteralNumberBin */ .chroma .mb { color: #f5a97f }
|
||||||
|
/* LiteralNumberFloat */ .chroma .mf { color: #f5a97f }
|
||||||
|
/* LiteralNumberHex */ .chroma .mh { color: #f5a97f }
|
||||||
|
/* LiteralNumberInteger */ .chroma .mi { color: #f5a97f }
|
||||||
|
/* LiteralNumberIntegerLong */ .chroma .il { color: #f5a97f }
|
||||||
|
/* LiteralNumberOct */ .chroma .mo { color: #f5a97f }
|
||||||
|
/* Operator */ .chroma .o { color: #91d7e3; font-weight: bold }
|
||||||
|
/* OperatorWord */ .chroma .ow { color: #91d7e3; font-weight: bold }
|
||||||
|
/* Punctuation */ .chroma .p { }
|
||||||
|
/* Comment */ .chroma .c { color: #6e738d; font-style: italic }
|
||||||
|
/* CommentHashbang */ .chroma .ch { color: #6e738d; font-style: italic }
|
||||||
|
/* CommentMultiline */ .chroma .cm { color: #6e738d; font-style: italic }
|
||||||
|
/* CommentSingle */ .chroma .c1 { color: #6e738d; font-style: italic }
|
||||||
|
/* CommentSpecial */ .chroma .cs { color: #6e738d; font-style: italic }
|
||||||
|
/* CommentPreproc */ .chroma .cp { color: #6e738d; font-style: italic }
|
||||||
|
/* CommentPreprocFile */ .chroma .cpf { color: #6e738d; font-weight: bold; font-style: italic }
|
||||||
|
/* Generic */ .chroma .g { }
|
||||||
|
/* GenericDeleted */ .chroma .gd { color: #ed8796; background-color: #363a4f }
|
||||||
|
/* GenericEmph */ .chroma .ge { font-style: italic }
|
||||||
|
/* GenericError */ .chroma .gr { color: #ed8796 }
|
||||||
|
/* GenericHeading */ .chroma .gh { color: #f5a97f; font-weight: bold }
|
||||||
|
/* GenericInserted */ .chroma .gi { color: #a6da95; background-color: #363a4f }
|
||||||
|
/* GenericOutput */ .chroma .go { }
|
||||||
|
/* GenericPrompt */ .chroma .gp { }
|
||||||
|
/* GenericStrong */ .chroma .gs { font-weight: bold }
|
||||||
|
/* GenericSubheading */ .chroma .gu { color: #f5a97f; font-weight: bold }
|
||||||
|
/* GenericTraceback */ .chroma .gt { color: #ed8796 }
|
||||||
|
/* GenericUnderline */ .chroma .gl { text-decoration: underline }
|
||||||
|
/* TextWhitespace */ .chroma .w { }
|
|
@ -31,7 +31,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content :not(table) ::-webkit-scrollbar-thumb {
|
.post-content :not(table) ::-webkit-scrollbar-thumb {
|
||||||
border: 2px solid var(--hljs-bg);
|
border: 2px solid var(--code-block-bg);
|
||||||
background: rgb(113, 113, 117);
|
background: rgb(113, 113, 117);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -55,12 +55,12 @@
|
||||||
{{- $license_css := (resources.Get "css/core/license.css") }}
|
{{- $license_css := (resources.Get "css/core/license.css") }}
|
||||||
{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }}
|
{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }}
|
||||||
|
|
||||||
{{- /* include `an-old-hope` if hljs is on */}}
|
{{- /* markup.highlight.noClasses should be set to `false` */}}
|
||||||
{{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default false) }}
|
{{- $chroma_styles := (resources.Get "css/includes/chroma-styles.css") }}
|
||||||
{{- $hljs := (cond ($isHLJSdisabled) (".chroma { background-color: unset !important;}" | resources.FromString "assets/css/hljs-blank.css") (resources.Get "css/hljs/an-old-hope.min.css")) }}
|
{{- $chroma_mod := (resources.Get "css/includes/chroma-mod.css") }}
|
||||||
|
|
||||||
{{- /* order is important */}}
|
{{- /* order is important */}}
|
||||||
{{- $core := (slice $theme_vars $reset $common $hljs $includes_all $media) | resources.Concat "assets/css/core.css" | resources.Minify }}
|
{{- $core := (slice $theme_vars $reset $common $chroma_styles $chroma_mod $includes_all $media) | resources.Concat "assets/css/core.css" | resources.Minify }}
|
||||||
{{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" | resources.Minify }}
|
{{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" | resources.Minify }}
|
||||||
|
|
||||||
{{- /* bundle all required css */}}
|
{{- /* bundle all required css */}}
|
||||||
|
@ -89,19 +89,6 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- /* Highlight.js */}}
|
|
||||||
{{- $isHLJSdisabled := (site.Params.assets.disableHLJS | default .Params.disableHLJS ) }}
|
|
||||||
{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }}
|
|
||||||
{{- if not site.Params.assets.disableFingerprinting }}
|
|
||||||
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | fingerprint }}
|
|
||||||
<script defer crossorigin="anonymous" src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}"
|
|
||||||
onload="hljs.initHighlightingOnLoad();"></script>
|
|
||||||
{{- else }}
|
|
||||||
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" }}
|
|
||||||
<script defer crossorigin="anonymous" src="{{ $highlight.RelPermalink }}" onload="hljs.initHighlightingOnLoad();"></script>
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- /* Favicons */}}
|
{{- /* Favicons */}}
|
||||||
<link rel="icon" href="{{ site.Params.assets.favicon | default "favicon.ico" | absURL }}">
|
<link rel="icon" href="{{ site.Params.assets.favicon | default "favicon.ico" | absURL }}">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL }}">
|
<link rel="icon" type="image/png" sizes="16x16" href="{{ site.Params.assets.favicon16x16 | default "favicon-16x16.png" | absURL }}">
|
||||||
|
@ -137,7 +124,7 @@
|
||||||
--secondary: rgb(155, 156, 157);
|
--secondary: rgb(155, 156, 157);
|
||||||
--tertiary: rgb(65, 66, 68);
|
--tertiary: rgb(65, 66, 68);
|
||||||
--content: rgb(196, 196, 197);
|
--content: rgb(196, 196, 197);
|
||||||
--hljs-bg: rgb(46, 46, 51);
|
--code-block-bg: rgb(46, 46, 51);
|
||||||
--code-bg: rgb(55, 56, 62);
|
--code-bg: rgb(55, 56, 62);
|
||||||
--border: rgb(51, 51, 51);
|
--border: rgb(51, 51, 51);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue