~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/pds.js

An atproto PDS in JavaScript, for Cloudflare Workers and Node

0
0
main
14 lines · 454 B Raw History
/**
 * Point the stylesheet at an appearance choice. An explicit light or dark pins
 * the palette through the root data-theme attribute; anything else removes
 * the attribute so the prefers-color-scheme rules decide.
 * @param {string} [theme]
 */
export function applyTheme(theme) {
  const root = document.documentElement;
  if (theme === 'light' || theme === 'dark') {
    root.dataset.theme = theme;
  } else {
    delete root.dataset.theme;
  }
}