Skip to content

Commit

Permalink
Remove all JS. Prefer CSS media query
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-T committed Feb 27, 2025
1 parent d4bc3c0 commit 2b3f2f8
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions ios/brave-ios/Sources/Brave/Assets/About/AboutHome.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,19 @@
transition: background-color 0.1s, color 0.1s;
}

body.light-mode {
background-color: #LIGHT_MODE_COLOUR;
.theme {
color: black;
background-color: #LIGHT_MODE_COLOUR;
}

body.dark-mode {
background-color: #DARK_MODE_COLOUR;
color: white;
@media (prefers-color-scheme: dark) {
.theme {
color: white;
background-color: #DARK_MODE_COLOUR;
}
}
</style>
</head>
<body>
<script>
function applyTheme() {
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
document.body.classList.remove("light-mode");
document.body.classList.add('dark-mode');
} else {
document.body.classList.remove("dark-mode");
document.body.classList.add("light-mode");
}
}

applyTheme();

let themeMatch = window.matchMedia("(prefers-color-scheme: dark)");
if (themeMatch) {
themeMatch.addEventListener("change", (event) => {
applyTheme();
});
}
</script>
<body class="theme">
</body>
</html>

0 comments on commit 2b3f2f8

Please sign in to comment.