{# This is where user-provided CSS variables get converted into actual values. #} {% macro declare_css_variables(user_customisations, pygments_theme) -%} --color-code-background: {{ pygments_theme.background }}; --color-code-foreground: {{ pygments_theme.foreground }}; {% if user_customisations -%} {% for name, value in user_customisations.items() -%} --{{ name }}: {{ value }}; {% endfor %} {%- endif %} {%- endmacro %} {% macro declare_font_variables(user_customisations) -%} {% if user_customisations -%} {% for src in user_customisations.src -%} @font-face { font-family: {{ user_customisations.name }}; font-weight: {{ src.weight }}; font-style: normal; font-display: swap; src: url({{ src.url }}) format({{ user_customisations.type }}); } {% endfor %} {% if user_customisations.font_stack -%} :root { --font-stack: {{ user_customisations.font_stack}}, -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji; } {% else %} :root { --font-stack: Georgia, {{ user_customisations.name}}, STXihei, -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji; } {%- endif %} {%- endif %} {%- endmacro %}