Skip to content

Cranberry palette refresh + dark mode - #291

Open
EmilHvitfeldt wants to merge 7 commits into
mainfrom
cranberry-palette-refresh
Open

Cranberry palette refresh + dark mode#291
EmilHvitfeldt wants to merge 7 commits into
mainfrom
cranberry-palette-refresh

Conversation

@EmilHvitfeldt

@EmilHvitfeldt EmilHvitfeldt commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Adopts the Posit creative team's accessible cranberry color family (base #BA355F) and adds a light/dark theme toggle to the site.

Two logical pieces, sequenced so the palette refresh could stand alone:

  1. Palette refresh (light) — swap the base cranberry #CA225E#BA355F and key the light theme off a named seven-step ramp.
  2. Dark mode — add a dark: theme with a navbar toggle, deriving the dark surface from the existing tidymodels ink (#1A162D), and make the previously light-only styles theme-aware.

Palette and contrast guidance come from Tidymodels-ColorGuidance-Accessibility-2025 (Posit creative team), documented against WCAG 2.2 AA.

What changed

  • _cranberry.scss (new): shared color ramp as SCSS variables ($cranberry-light-1$cranberry-dark-3, surfaces, inks, $theme-blue/$theme-blue-dark), layered into both themes.
  • styles.scss: base cranberry #BA355F, link/hover/focus-ring and table tints keyed off the ramp.
  • _quarto.yml: theme: moved under format: html: as a light:/dark: mapping; respect-user-color-scheme: true.
  • styles-dark.scss (new): dark Bootstrap defaults + .quarto-dark-scoped rule overrides (h2, code/tables/session-info, resource stickies, and the front page bands/event card; decorative tidy-back-*.svg backgrounds hidden on dark).
  • find/listing-cards.css, start/styles.css: .quarto-dark override blocks (plain CSS, ramp values inlined); start/styles.css mirrored value updated to #BA355F.
  • learn/models/parsnip-predictions/index.qmd: page-level theme: converted to the mapping shape so it merges with the site light/dark themes.
  • README.md: new "Color palette" and "Light and dark themes" styling docs.

Accessibility

Contrast ratios verified against the guidance (all pass their WCAG tiers):

role color / surface ratio
link (light) #BA355F on white 5.58 (AA)
link (dark) #CB6585 on #1A162D 4.80 (AA)
code (dark) #919BCD on #1A162D 6.50 (AA)
body (dark) #DDDDDD on #1A162D 12.92 (AAA)
focus ring #BA355F on white 5.58 (>3.0 UI)

Notes / follow-ups

  • Sass layering: _cranberry.scss is listed last (Quarto emits scss:defaults from later-listed files first); styles-dark.scss is listed before styles.scss so its variable overrides win, with rule overrides scoped under .quarto-dark for specificity. Documented in the README.
  • Re-render pending: the parsnip-predictions freeze is invalidated by the front-matter fix and will re-render in CI. That first data-heavy render is the moment to review dark-mode output tables.
  • Not yet done: live in-browser eyeball of the toggle across both themes.
  • The decorative front-page illustrations still carry the old #CA225E and are simply hidden on dark; purpose-built dark variants are a possible future improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant