Default to monokai in dark theme and fixed defaulting mechanism in the JS
This commit is contained in:
parent
927306ddb9
commit
0d56e19d6a
2 changed files with 3 additions and 3 deletions
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
media="(prefers-color-scheme: dark)"
|
media="(prefers-color-scheme: dark)"
|
||||||
href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE_DARK|default('github') }}.min.css">
|
href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE_DARK|default('monokai') }}.min.css">
|
||||||
<link rel="stylesheet" type="text/css"
|
<link rel="stylesheet" type="text/css"
|
||||||
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
|
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
|
||||||
href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE|default('github') }}.min.css">
|
href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE|default('github') }}.min.css">
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
// Find the pygments CSS files (there are two, one for each theme) and
|
// Find the pygments CSS files (there are two, one for each theme) and
|
||||||
// change them both to the theme specified by the user.
|
// change them both to the theme specified by the user.
|
||||||
const pygmentsTheme = theme === 'light'
|
const pygmentsTheme = theme === 'light'
|
||||||
? '{{ PYGMENTS_STYLE }}'
|
? '{{ PYGMENTS_STYLE|default('github') }}'
|
||||||
: '{{ PYGMENTS_STYLE_DARK or PYGMENTS_STYLE }}'
|
: '{{ PYGMENTS_STYLE_DARK|default('monokai') }}'
|
||||||
Array.from(document.head.getElementsByTagName('link')).forEach(linkEl => {
|
Array.from(document.head.getElementsByTagName('link')).forEach(linkEl => {
|
||||||
if (linkEl.href.match(/\/theme\/pygments\/.*\.min\.css/)) {
|
if (linkEl.href.match(/\/theme\/pygments\/.*\.min\.css/)) {
|
||||||
linkEl.href = `/theme/pygments/${pygmentsTheme}.min.css`;
|
linkEl.href = `/theme/pygments/${pygmentsTheme}.min.css`;
|
||||||
|
|
Loading…
Reference in a new issue