[nu-demo] hero_books library cards have poor light-mode text contrast — titles invisible on dark gradient backgrounds #184
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Hero Books "Knowledge World" homepage rendered under hero_os light mode has poor text contrast on the library cards:
Affects only hero_os in light mode; in dark mode the cards' dark backgrounds are appropriate.
Root cause hypothesis
Hero Books's library card CSS likely uses fixed light-color text variables that look correct on the card's dark gradient when hero_os is in dark mode (overall light text on dark backgrounds is the design), but doesn't contrast-flip when hero_os is in light mode. The library cards keep their dark gradient backgrounds (intentional brand color) but the title text doesn't adjust.
Fix direction
The card body should always use light text since the card backgrounds are deliberately dark gradients regardless of overall theme. Two options:
Hardcode card text color: in
hero_books/templates/...(Askama) orhero_books_uiDioxus, set library card titles tocolor: whiteorcolor: rgba(255,255,255,0.95)directly, not via theme tokens.Theme-aware: use a card-text token that's identical in light and dark modes (e.g.,
--hero-books-card-text: rgba(255,255,255,0.95)defined in both themes).Option 1 is simpler and matches the design intent: the cards are always dark, so text is always light.
Where to look
hero_books_ui/templates/index.html(Knowledge World homepage)hero_books_ui/static/css/*.css— library card classeshero_archipelagos/archipelagos/embed/books/...— if the homepage is rendered by the WASM islandDemo state
Visible on herodemo.gent01.grid.tf in light mode. Functional (cards clickable, navigation works) — purely cosmetic contrast issue.
Related
Signed-off-by: mik-tf
Fixed in hero_books commit
10493f5ondevelopment.Root cause — pinned via Hero Browser MCP CSS inspection on the live herodemo:
Bootstrap 5.3 cascades light-theme body color via
[data-bs-theme="light"] .card(specificity(0,2,0)). The library cards' theme rule.lib-theme-N { color: #e8e8e8 }is only specificity(0,1,0), so Bootstrap's rule wins regardless of source order. Result: in light mode the dark body color (rgb(33, 37, 41)) cascades into all.library-cardcontent, rendering titles invisible against the always-dark navy/red/purple gradients.Fix — chain the selector to
.library-card.lib-theme-N(now(0,2,0)) so it ties Bootstrap's specificity and wins via source order (the inline<style>loads afterbootstrap.min.css):Applied to all 6 lib-theme-N variants. Inner content (
.card-body,.library-name,.library-stats) is pinned tocolor: inheritso children pick up the parent's gradient-aware light color regardless of theme.Verification — live test on herodemo via Hero Browser MCP
js_evaluate:/tmp/books_light.png).getComputedStyle()—.library-namecolor wasrgb(33, 37, 41).Array.from(document.styleSheets)rule walk —[data-bs-theme="light"] .card → var(--bs-body-color).rgb(232, 232, 232)./tmp/books_light_fixed.png)./tmp/books_dark_fixed.png).Deploy: the fix lands automatically on next hero_books_ui binary rebuild — the template is embedded into the binary at build time. No infra changes needed. Will reach herodemo on the next combined deploy.
Meta-tracker: home#193.
Signed-off-by: mik-tf