Intro-to-Jinja-tpl-v2/templates/macros.html

19 lines
466 B
HTML

{# templates/macros.html #}
{% macro light_or_dark_mode(element) %}
{% if request.args.get('mode') == "dark" %}
<a href="{{ request.path }}">Cambiamos a Modo Claro</a>
<style>
{{ element }} {
background-color: #212F3C;
color: #FFFFF0;
}
{{ element }} a {
color: #00BFFF !important;
}
</style>
{% else %}
<a href="{{ request.path }}?mode=dark">Cambiamos a Modo Oscuro</a>
{% endif %}
{% endmacro %}