neiam
/recourse
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
Reaction emoji tinted with the theme primary until hovered
6b4f785 · gmorell · 2026-12-03 02:43
Message
{commit_body(@commit)}
Files changed
modified
assets/f/css/style.css
+9
−0
@@ -6,6 +6,15 @@
| 6 | 6 | @tailwind components; |
| 7 | 7 | @tailwind utilities; |
| 8 | 8 | |
| 9 | +/* Reaction emoji: tinted with the theme primary (the #emoji-tint SVG filter | |
| 10 | + in root.html) until their button, badge or Focus tile is hovered or | |
| 11 | + focused. */ | |
| 12 | +.emoji-tint { filter: url(#emoji-tint); opacity: .85; transition: opacity 150ms; } | |
| 13 | +.group\/react:hover .emoji-tint, | |
| 14 | +.group\/react:focus-visible .emoji-tint, | |
| 15 | +.group\/tile:hover .emoji-tint, | |
| 16 | +.group\/tile:focus-visible .emoji-tint { filter: none; opacity: 1; } | |
| 17 | + | |
| 9 | 18 | /* htmx request indicator helpers */ |
| 10 | 19 | .htmx-indicator { opacity: 0; transition: opacity 300ms ease-in; } |
| 11 | 20 | .htmx-request .htmx-indicator { opacity: 1; } |
modified
templates/forum/_post.html
+1
−1
@@ -34,7 +34,7 @@
| 34 | 34 | {% include "forum/_reactions.html" %} |
| 35 | 35 | {% elif post.reactions %} |
| 36 | 36 | <div class="flex flex-wrap items-center gap-1 mt-2"> |
| 37 | − {% for r in post.reactions %}{% if r.count > 0 %}<span class="group/react badge badge-ghost badge-sm"><span class="grayscale opacity-70 transition duration-150 group-hover/react:grayscale-0 group-hover/react:opacity-100">{{ r.emoji }}</span> {{ r.count }}</span>{% endif %}{% endfor %} | |
| 37 | + {% for r in post.reactions %}{% if r.count > 0 %}<span class="group/react badge badge-ghost badge-sm"><span class="emoji-tint">{{ r.emoji }}</span> {{ r.count }}</span>{% endif %}{% endfor %} | |
| 38 | 38 | </div> |
| 39 | 39 | {% endif %} |
| 40 | 40 | {% if user %} |
modified
templates/forum/_reactions.html
+3
−2
@@ -2,8 +2,9 @@
| 2 | 2 | {% for r in post.reactions %} |
| 3 | 3 | <button hx-post="/p/{{ post.id }}/react/{{ r.key }}" hx-target="#reactions-{{ post.id }}" hx-select="unset" hx-swap="outerHTML" |
| 4 | 4 | type="button" class="group/react btn btn-xs {% if r.reacted %}btn-primary{% else %}btn-ghost{% endif %}" title="{{ r.key }}"> |
| 5 | − {# Emoji stay monochrome until hovered or focused. #} | |
| 6 | − <span class="grayscale opacity-70 transition duration-150 group-hover/react:grayscale-0 group-hover/react:opacity-100 group-focus-visible/react:grayscale-0 group-focus-visible/react:opacity-100">{{ r.emoji }}</span>{% if r.count > 0 %}<span class="ml-1 font-mono">{{ r.count }}</span>{% endif %} | |
| 5 | + {# Emoji are tinted with the theme primary until hovered or focused (.emoji-tint, | |
| 6 | + style.css); your own reactions sit on btn-primary, so they keep full colour. #} | |
| 7 | + <span class="{% if not r.reacted %}emoji-tint{% endif %}">{{ r.emoji }}</span>{% if r.count > 0 %}<span class="ml-1 font-mono">{{ r.count }}</span>{% endif %} | |
| 7 | 8 | </button> |
| 8 | 9 | {% endfor %} |
| 9 | 10 | </div> |
modified
templates/forum/_topic_tile.html
+1
−1
@@ -28,7 +28,7 @@
| 28 | 28 | {% for p in t.posters %}<span class="rounded-full ring-2 ring-base-100 inline-flex">{{ ui.avatar(p.id, p.name, p.has_avatar, "size-6", "text-[0.65rem]") | safe }}</span>{% endfor %} |
| 29 | 29 | </span> |
| 30 | 30 | <span class="flex items-center gap-1 text-xs"> |
| 31 | − {% for r in t.reactions %}<span class="badge badge-ghost badge-sm"><span class="grayscale opacity-70 transition duration-150 group-hover/tile:grayscale-0 group-hover/tile:opacity-100 group-focus-visible/tile:grayscale-0 group-focus-visible/tile:opacity-100">{{ r.emoji }}</span> {{ r.count }}</span>{% endfor %} | |
| 31 | + {% for r in t.reactions %}<span class="badge badge-ghost badge-sm"><span class="emoji-tint">{{ r.emoji }}</span> {{ r.count }}</span>{% endfor %} | |
| 32 | 32 | </span> |
| 33 | 33 | </div> |
| 34 | 34 | <div class="flex items-center justify-between text-xs opacity-70 font-mono"> |
modified
templates/root.html
+13
−0
@@ -42,6 +42,19 @@
| 42 | 42 | hx-select="#content" |
| 43 | 43 | hx-swap="outerHTML show:window:top" |
| 44 | 44 | {% if user %}data-authed="1"{% endif %}> |
| 45 | +{# The theme-primary tint for reaction emoji (.emoji-tint in style.css): greyscale | |
| 46 | + for the shading, the primary's hue and saturation on top, clipped to the | |
| 47 | + glyph. Sized 0 and positioned away rather than display:none, which would | |
| 48 | + switch the filter off in some browsers. #} | |
| 49 | +<svg width="0" height="0" class="absolute" aria-hidden="true" focusable="false"> | |
| 50 | + <filter id="emoji-tint" color-interpolation-filters="sRGB"> | |
| 51 | + <feColorMatrix in="SourceGraphic" type="saturate" values="0" result="grey"/> | |
| 52 | + <feFlood style="flood-color: oklch(var(--p))" result="primary"/> | |
| 53 | + <feComposite in="primary" in2="SourceAlpha" operator="in" result="shape"/> | |
| 54 | + <feBlend in="shape" in2="grey" mode="color" result="tinted"/> | |
| 55 | + <feComposite in="tinted" in2="SourceAlpha" operator="in"/> | |
| 56 | + </filter> | |
| 57 | +</svg> | |
| 45 | 58 | <header class="navbar px-4 sm:px-6 lg:px-8 border-b border-base-300 bg-base-200"> |
| 46 | 59 | <div class="flex-1 flex items-center gap-3"> |
| 47 | 60 | <a href="/" class="flex w-fit items-center gap-2" title="Home"> |
Parents: 0c6677d