UNPKG

daynitejs

Version:

A lightweight JavaScript library for toggling light and dark themes.

15 lines (14 loc) 356 B
/** * System preference utilities for DayniteJs. * @module System */ /** * Gets the system theme preference. * @returns {string} 'dark' or 'light'. */ export function getSystemTheme() { if (typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { return 'dark'; } return 'light'; }