Skip to content

Commit a851d60

Browse files
committed
chore(mode): test of mode switcher to reduce light flash
1 parent 30c93af commit a851d60

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • packages/documentation-framework/templates

packages/documentation-framework/templates/html.ejs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
<!DOCTYPE html>
22
<html lang="en-US">
33
<head>
4+
<script>
5+
(function() {
6+
try {
7+
var mode = localStorage.getItem('theme-preference');
8+
if (!mode || mode === 'system') {
9+
mode = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
10+
}
11+
if (mode === 'dark') {
12+
document.documentElement.classList.add('pf-v6-theme-dark');
13+
}
14+
} catch (e) {}
15+
})();
16+
</script>
417
<meta charset="utf-8">
518
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
619
<meta name="description" content="PatternFly is Red Hat's open source design system. It consists of components, documentation, and code for building enterprise applications at scale.">

0 commit comments

Comments
 (0)