From 41639655ffaa9914632fe937c9583b901b36f5cc Mon Sep 17 00:00:00 2001 From: diondiondion Date: Tue, 13 Jan 2026 12:06:54 +0100 Subject: [PATCH] Fix `isDarkMode` utility (#37470) --- app/javascript/mastodon/utils/theme.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/javascript/mastodon/utils/theme.ts b/app/javascript/mastodon/utils/theme.ts index 767d97cf5c..921787a6c4 100644 --- a/app/javascript/mastodon/utils/theme.ts +++ b/app/javascript/mastodon/utils/theme.ts @@ -5,9 +5,7 @@ export function getUserTheme() { export function isDarkMode() { const { userTheme } = document.documentElement.dataset; - return ( - (userTheme === 'system' && - window.matchMedia('(prefers-color-scheme: dark)').matches) || - userTheme !== 'mastodon-light' - ); + return userTheme === 'system' + ? window.matchMedia('(prefers-color-scheme: dark)').matches + : userTheme !== 'mastodon-light'; }