Smart syntax highlighting theme loading

This commit is contained in:
daudix
2024-06-20 09:52:50 +03:00
parent c425091260
commit 8e77b6f931
2 changed files with 13 additions and 10 deletions

View File

@ -8,9 +8,9 @@
animation: flicker 0.25s alternate infinite; animation: flicker 0.25s alternate infinite;
margin: unset; margin: unset;
box-shadow: unset; box-shadow: unset;
background-color: unset; background-color: unset !important;
padding: 1rem 1rem; padding: 1rem 1rem;
color: var(--primary-color); color: var(--primary-color) !important;
text-shadow: var(--primary-color-alpha) 0 0 4px, var(--primary-color) 0 0 12px; text-shadow: var(--primary-color-alpha) 0 0 4px, var(--primary-color) 0 0 12px;
@keyframes flicker { @keyframes flicker {

View File

@ -7,28 +7,31 @@
<meta name="theme-color" content="{{ config.extra.primary_color }}" /> <meta name="theme-color" content="{{ config.extra.primary_color }}" />
<link rel="canonical" href="{{ current_url | default(value='/') | safe }}" /> <link rel="canonical" href="{{ current_url | default(value='/') | safe }}" />
<title>{% include "partials/title.html" %}</title> <title>{% include "partials/title.html" %}</title>
<link rel="stylesheet" href="{{ get_url(path='syntax-theme-dark.css') }}" media="(prefers-color-scheme: dark)" />
<link rel="stylesheet" href="{{ get_url(path='syntax-theme-light.css') }}" media="(prefers-color-scheme: light)" />
{# Define array of CSS files to load. main.css is always loaded. #} {% if config.markdown.highlight_code and config.markdown.highlight_theme == "css" %}
{% if config.markdown.highlight_themes_css | length > 0 %}
<link rel="stylesheet" href="{{ get_url(path='syntax-theme-light.css') }}" media="(prefers-color-scheme: light)" />
<link rel="stylesheet" href="{{ get_url(path='syntax-theme-dark.css') }}" media="(prefers-color-scheme: dark)" />
{% else %}
<link rel="stylesheet" href="{{ get_url(path='syntax-theme.css') }}" />
{% endif %}
{% endif %}
{% set stylesheets = [ "style.css" ] %} {% set stylesheets = [ "style.css" ] %}
{# Load extra CSS files from config.toml #}
{% if config.extra.stylesheets -%} {% if config.extra.stylesheets -%}
{% set stylesheets = stylesheets | concat(with=config.extra.stylesheets) %} {% set stylesheets = stylesheets | concat(with=config.extra.stylesheets) %}
{% endif %} {% endif %}
{# Load extra CSS files from page metadata #}
{% if page.extra.stylesheets %} {% if page.extra.stylesheets %}
{% set stylesheets = stylesheets | concat(with=page.extra.stylesheets) %} {% set stylesheets = stylesheets | concat(with=page.extra.stylesheets) %}
{% elif section.extra.stylesheets %} {% elif section.extra.stylesheets %}
{% set stylesheets = stylesheets | concat(with=section.extra.stylesheets) %} {% set stylesheets = stylesheets | concat(with=section.extra.stylesheets) %}
{% endif %} {% endif %}
{# Load all stylesheets #} {% for stylesheet in stylesheets %}
{%- for stylesheet in stylesheets %}
<link rel="stylesheet" href="{{ get_url(path=stylesheet) | safe }}" /> <link rel="stylesheet" href="{{ get_url(path=stylesheet) | safe }}" />
{%- endfor %} {% endfor %}
<style type="text/css"> <style type="text/css">
:root { :root {