Skip to content

Commit

Permalink
Update <meta> color-scheme based on theme
Browse files Browse the repository at this point in the history
Fixes #71
  • Loading branch information
dsevillamartin committed Aug 28, 2023
1 parent e4880f8 commit 5b282ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/src/common/setSelectedTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ export function setStyle(type) {
}
}

const colorScheme = document.querySelector('meta[name="color-scheme"]');

if (colorScheme) {
colorScheme.content = type === 'night' ? 'dark' : 'light';
}

// Dispatch a 'fofnightmodechange' event with 'day' or 'night' as detail.
// This allows other extensions to integrate with this one.
const event = new CustomEvent('fofnightmodechange', { detail: type });
Expand Down

0 comments on commit 5b282ff

Please sign in to comment.