Make pygments style switching work when JS is off, but prefers-color-scheme is enabled
This commit is contained in:
parent
5955f45a30
commit
02e1404e34
2 changed files with 8 additions and 3 deletions
|
@ -36,7 +36,12 @@
|
|||
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.min.css" />
|
||||
{% endif %}
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE|default('github') }}.min.css">
|
||||
<link rel="stylesheet" type="text/css"
|
||||
media="(prefers-color-scheme: dark)"
|
||||
href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE_DARK|default('github') }}.min.css">
|
||||
<link rel="stylesheet" type="text/css"
|
||||
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
|
||||
href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/pygments/{{ PYGMENTS_STYLE|default('github') }}.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/fontawesome.css">
|
||||
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/brands.css">
|
||||
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/solid.css">
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
}
|
||||
console.log(`Switching theme to ${theme}.`)
|
||||
|
||||
// Find the pygments CSS file and change it to the theme specified in the
|
||||
// config.
|
||||
// Find the pygments CSS files (there are two, one for each theme) and
|
||||
// change them both to the theme specified by the user.
|
||||
const pygmentsTheme = theme === 'light'
|
||||
? '{{ PYGMENTS_STYLE }}'
|
||||
: '{{ PYGMENTS_STYLE_DARK or PYGMENTS_STYLE }}'
|
||||
|
|
Loading…
Reference in a new issue