~/talk

CSS + Cookies: A Perfectionist's Approach to Theming

Talkat Next.js Conf 2020 · on Tuesday, 2020-10-27· [css, web-platform]
slides:none on file

Uses CSS variables and :root for light/dark theming with server-rendered Next.js pages, and pairs that with a cookie-based override so the server can send HTML that matches user preference and avoids the initial dark-mode flash. Shows a useTheme hook, a small middleware to persist preference to a database, per-page class overrides, and an open-source demo (ndafi) that still works when JavaScript is turned off.

AI-written summary · about

  1. 0:00Intro
  2. 0:53Why dark mode?
  3. 1:24I mean.. it's just dark mode, right?
  4. 1:58Dark mode in plain CSS
  5. 3:16More Requirements
  6. 3:42Dark mode in CSS in JS (styled-components)
  7. 5:15Things are a little different on the server
  8. 6:22CSS + Cookies
  9. 9:45Persisting user's preference
  10. 10:37Demo
  11. 11:08Is there a better way?
  12. 11:52And what about SSG?
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.