theme.py 402 B

123456789101112
  1. """Pins prefers-color-scheme; OliveTin's dark mode follows the browser.
  2. repo-helper reuses one browser session for every section, so each section
  3. must set the scheme explicitly or it inherits the previous one.
  4. """
  5. def set_color_scheme(driver, scheme):
  6. driver.execute_cdp_cmd(
  7. "Emulation.setEmulatedMedia",
  8. {"features": [{"name": "prefers-color-scheme", "value": scheme}]},
  9. )