Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
🎨 Make time of day usage more distinct
Browse files Browse the repository at this point in the history
  • Loading branch information
acollierr17 committed Feb 18, 2021
1 parent f2b34d8 commit f6a6eee
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/Mode/applyMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function applyMode (mode) {

const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
const noThemeMediaQueries = !isDarkMode && !isLightMode

if (isDarkMode) render('dark')
if (isLightMode) render('light')
Expand All @@ -30,7 +31,9 @@ export default function applyMode (mode) {
* 6 AM - 6 PM: Light mode
* 6 PM - 5 AM: Dark mode
*/
const hour = new Date().getHours()
if (hour < 6 || hour >= 18) render('dark')
else render('light')
if (noThemeMediaQueries) {
const hour = new Date().getHours()
if (hour < 6 || hour >= 18) render('dark')
else render('light')
}
}

0 comments on commit f6a6eee

Please sign in to comment.