(mode: ThemeMode)
| 557 | } |
| 558 | |
| 559 | const applyMode = (mode: ThemeMode): void => { |
| 560 | const prefersDark = |
| 561 | mode === 'dark' || |
| 562 | (mode === 'auto' && |
| 563 | typeof window !== 'undefined' && |
| 564 | window.matchMedia('(prefers-color-scheme: dark)').matches) |
| 565 | const id = resolveAuto(themeFamily, prefersDark, themeId) |
| 566 | setTheme({ id, family: themeFamily, mode }) |
| 567 | } |
| 568 | |
| 569 | // Some families ship multiple flavors of the same mode (Gruvbox hard/medium/ |
| 570 | // soft, GitHub default/dimmed/high-contrast, Catppuccin frappe/macchiato/ |
no test coverage detected