Skip to content

Commit

Permalink
Checking device theme
Browse files Browse the repository at this point in the history
  • Loading branch information
roma160 committed Jul 11, 2023
1 parent d44f027 commit 5eaa9be
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion svelte/src/lib/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
left: 0;
top: 0;
width: 100%;
height: 100%;
position: fixed;
}

html, body {
margin: 0 !important;
padding: 0 !important;
height: 1000px;
}
</style>
</head>
Expand All @@ -29,10 +30,17 @@

<!-- Allow the C++ to access the canvas element -->
<script type='text/javascript'>
//https://stackoverflow.com/a/57795495/8302811
let dark_mode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
if(dark_mode) {
document.body.style.backgroundColor = "black";
}

var Module = {
canvas: ( function () { return document.getElementById( 'canvas' ); } )(),
// Uncomment this to enable mouse wheel
// arguments: ["--wheel"]
arguments: [dark_mode ? "--dark" : "--light"]
};
</script>

Expand Down

0 comments on commit 5eaa9be

Please sign in to comment.