javascript
Published on January 26, 2024By DeveloperBreeze
// Check if the user prefers dark mode using window.matchMedia
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
// Log whether dark mode is preferred by the user
console.log('Dark Mode:', isDarkMode);
Comments
Please log in to leave a comment.