Add a secondary brand colour for clubs

Mirrors primary_color: a club-picked hex highlight used for accents like
the avatar-initials badge, with a computed readable text colour so a
pale pick doesn't produce white-on-yellow text. The shared contrast math
moves into _content_color_for so both colours use the same rule.
This commit is contained in:
2026-07-27 10:26:31 +02:00
parent ccaa9e991a
commit 075c2918b6
5 changed files with 67 additions and 11 deletions

View File

@@ -10,17 +10,24 @@
{% endblock title %}
{% block extra %}
{% if club.primary_color %}
{% if club.primary_color or club.secondary_color %}
{% comment %}
daisyUI declares its theme variables inside `@layer base`, and unlayered styles
beat every layered rule regardless of specificity -- so this plain :root wins
without any !important or selector games. primary_content_color is computed from
the club's colour so a pale brand doesn't end up with white-on-yellow buttons.
without any !important or selector games. primary_content_color / secondary_content_color
are computed from the club's colours so a pale brand doesn't end up with
white-on-yellow buttons or initials.
{% endcomment %}
<style>
:root {
--color-primary: {{ club.primary_color }};
--color-primary-content: {{ club.primary_content_color }};
{% if club.primary_color %}
--color-primary: {{ club.primary_color }};
--color-primary-content: {{ club.primary_content_color }};
{% endif %}
{% if club.secondary_color %}
--color-secondary: {{ club.secondary_color }};
--color-secondary-content: {{ club.secondary_content_color }};
{% endif %}
}
</style>
{% endif %}
@@ -33,7 +40,7 @@
{% else %}
{# Never the RosterChief mark: that would pass our branding off as the club's own. #}
<div class="avatar avatar-placeholder">
<div class="w-16 rounded-full bg-primary text-primary-content">
<div class="w-16 rounded-full bg-secondary text-secondary-content">
<span class="font-roboto text-xl font-bold">{{ club.initials }}</span>
</div>
</div>