Fix mismatched fallback text colour on the initials badge/button
The initials badge and reset button hardcoded two independent fallback literals -- a background (#ec4899 / #0ea5e9) and a text colour (#ffffff) -- that were only ever chosen together for a club's own colour via Club._content_color_for. #ffffff on #ec4899 or #0ea5e9 actually contrasts worse than black by the same WCAG formula the app already uses elsewhere (verified: 6.4:1 vs 3.3:1, and 7.6:1 vs 2.8:1). Added a contrast_color filter so the text colour is always derived from whatever background hex is actually in play -- real club colour or fallback alike -- instead of a second, independently guessed literal that can silently drift out of sync with the first. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
{% else %}
|
||||
<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="48" style="width:48px;">
|
||||
<tr>
|
||||
<td align="center" valign="middle" width="48" height="48" bgcolor="{{ club.secondary_color|default:"#ec4899" }}" style="width:48px; height:48px; border-radius:24px; background-color:{{ club.secondary_color|default:"#ec4899" }}; color:{{ club.secondary_content_color|default:"#ffffff" }}; font-family: Arial, Helvetica, sans-serif; font-size:16px; font-weight:bold;">
|
||||
<td align="center" valign="middle" width="48" height="48" bgcolor="{{ club.secondary_color|default:"#ec4899" }}" style="width:48px; height:48px; border-radius:24px; background-color:{{ club.secondary_color|default:"#ec4899" }}; color:{{ club.secondary_color|default:"#ec4899"|contrast_color }}; font-family: Arial, Helvetica, sans-serif; font-size:16px; font-weight:bold;">
|
||||
{{ club.initials }}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -43,7 +43,7 @@
|
||||
<p style="margin:0 0 20px 0;">{% blocktrans with club=club.name child=child %}{{ club }} has confirmed that you're {{ child }}'s parent or guardian, and your account is ready.{% endblocktrans %}</p>
|
||||
|
||||
{% trans "Set your password" as set_password_label %}
|
||||
{% include "email/_button.html" with href=set_password_url label=set_password_label bg=club.primary_color|default:"#4f46e5" fg=club.primary_content_color|default:"#ffffff" %}
|
||||
{% include "email/_button.html" with href=set_password_url label=set_password_label bg=club.primary_color|default:"#4f46e5" fg=club.primary_color|default:"#4f46e5"|contrast_color %}
|
||||
|
||||
<p style="margin:0 0 16px 0; font-size:13px; color:#6b7280;">{% trans "That link is for you alone — please don't forward it." %}</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user