{% macro govukLogo(params) %}
{% from "govuk_frontend_jinja/macros/attributes.html" import govukAttributes %}
{#- Default options #}
{%- set rebrand = params.rebrand | default(false) %}
{%- set useLogotype = params.useLogotype | default(true) %}
{%- set useTudorCrown = params.useTudorCrown | default(true) %}
{# Force use of Tudor Crown if rebrand flag is on. #}
{%- set useTudorCrown = true if rebrand else useTudorCrown %}
{#- Calculate how wide the logo needs to be for the given parameters. #}
{%- set svgWidth = 32 if useTudorCrown else 36 %}
{%- set svgWidth = svgWidth + 116 if (useLogotype and not rebrand) else svgWidth %}
{%- set svgWidth = svgWidth + 130 if (useLogotype and rebrand) else svgWidth %}
{#- Charles III's Tudor Crown icon has been the default since February 2024. #}
{%- set _tudorCrown %}
{%- endset %}
{#- St. Edward's Crown was the logo under Elizabeth II. It's included to avoid
a breaking change in services. It can be removed in Frontend v6. #}
{%- set _stEdwardsCrown %}
{%- endset %}
{#- The GOV.UK logotype with standard dot. This needs to be slightly offset if
using the St. Edward's Crown, as that crown is wider. #}
{%- set _logotype %}
{%- endset %}
{#- The GOV.UK logotype with raised and coloured dot. This is only intended for
use alongide the Tudor Crown, so don't bother with offsetting for the
St. Edward's Crown. #}
{%- set _dotLogotype %}
{%- endset %}
{#- The SVG needs `focusable="false"` so that Internet Explorer does not treat
it as an interactive element - without this it will be 'focusable' when using
the keyboard to navigate. #}
{% endmacro %}