Skip to content

Commit b4a907c

Browse files
Fix dark mode detection for system theme for highlight unfolded comments
1 parent c3d3b3d commit b4a907c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Highlight-Unfolded-Comments/StackHighlightUnfoldedComments.user.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ const observeContainer = (commentsContainer) => {
5757
}
5858
for (const comment of newComments) {
5959
window.setTimeout(() => {
60-
const highlightColor = document.body.matches('.theme-dark')
60+
const highlightColor =
61+
document.body.matches('.theme-system') && window.matchMedia('(prefers-color-scheme: dark)').matches ||
62+
document.body.matches('.theme-dark')
6163
? '#403d33' // Dark brown, close to default dark background
6264
: '#fff2e0'; // Pale yellow, close to default light background
6365
// eslint-disable-next-line no-param-reassign

0 commit comments

Comments
 (0)