mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-21 21:43:04 -05:00
[PR #1588] [MERGED] fix(tinytorch/ux): light/dark/hybrid contrast for tito CLI cards + tables + code blocks #8295
Reference in New Issue
Block a user
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?
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1588
Author: @farhan523
Created: 4/27/2026
Status: ✅ Merged
Merged: 4/27/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/tinytorch-light-mode-card-text-contrast📝 Commits (1)
85073cffix(tinytorch/ux): light/dark/hybrid contrast for tito CLI cards + tables📊 Changes
2 files changed (+84 additions, -1 deletions)
View changed files
📝
tinytorch/quarto/assets/styles/dark-mode.scss(+9 -0)📝
tinytorch/quarto/assets/styles/style.scss(+75 -1)📄 Description
Summary
Final round of contrast fixes for the tito CLI module pages. With this merge, every page under the tito CLI module is now fully readable in light mode, dark mode, and the hybrid state where
data-bs-theme="dark"stays sticky on<html>while the light stylesheet is the active bundle (a state Quarto's color-toggle JS can land users in).Three coordinated fixes, layered on top of upstream's existing inline-style safety net (
2707c0546):1. Light-fill panel text-color safety net (
style.scss+dark-mode.scss)The bg-flip safety net (lines 213-229 of
dark-mode.scss) only fires in dark mode. In light/hybrid the cards stayed light-fill, but text inherited--bs-body-colorwhich[data-bs-theme="dark"]resolves to#dee2e6(light) — invisible on a light card.style.scsspins text inside inline-styled light-fill cards to#1e293b.color: #e6e6e6 !importantline added to the existing bg-flip block indark-mode.scssso text flips back when the card flips dark.2. Code blocks inside cards
The previously-merged unscoped
pre code { color: #e6e6e6 }was painting plain fenced blocks light grey on the light card surface — visible on the box-drawing console output under "Understanding the Export Process" ontito/modules.qmd. Nestedpre code, codeoverrides inside both safety-net selector lists handle this for both modes.3. Scope existing global h3 +
pre codeoverrides to[data-bs-theme="dark"]These were left unscoped earlier to compensate for the hybrid state. The card safety net now handles hybrid for cards, so the global rules can be properly scoped. Fixes the
### Milestone Achievements: \tito milestone status`h3 ontito/data.qmdwhich was rendering as#d0d0d0` on white in true light mode.4. Table zebra-stripe override
shared/styles/partials/_tables.scss:138-144setstbody tr:nth-child(even) { background-color: #fafbfc }unconditionally. On the dark body, light body-text on a light row stripe was invisible. Added a[data-bs-theme="dark"]-scoped rule instyle.scssusing a subtle white-overlayrgba(255,255,255,0.04)so striping survives in both true dark and hybrid states without hardcoding a specific dark hue.Before / After
Light mode —
tito/modules.qmd"Environment Health" cardDark mode —
tito/overview.qmdtable + headingsLight Mode —
tito/data.qmdcode blocksAlot of code and blocks that are improved in tito cli module pages, which can be compared with https://mlsysbook.ai/tinytorch/tito/overview.html and local changes.
Test plan
cd tinytorch/quarto && quarto render --to htmlsucceeds for all 52 pagestito/modules.html,tito/data.html,tito/overview.html,tito/troubleshooting.html,tito/milestones.html,datasets.html,resources.html— all card content (titles, prose, bullets, code blocks) and h3 section headings readableprefers-color-scheme: light) — cards stay light-fill but text + code stays dark; tables get dark stripe via the data-bs-theme selectorOutcome
After this merge, all pages under the tito CLI module (
tito/overview,tito/modules,tito/data,tito/milestones,tito/troubleshooting,tito/testing) are fully readable in every theme state. The remaining inline-styled pages elsewhere in the site continue to benefit from the upstream safety net plus these new force-dark/scoped extensions.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.