A basic HTML file should look like this:
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The page supports both dark and light color schemes,
and the page author prefers / default is DARK. -->
<meta name="color-scheme" content="dark light">
<!-- Replace the Bootstrap CSS with the
Bootstrap-Dark Variant CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-unlit.min.css" rel="stylesheet">
<title>Hello, world!</title>
</head>
<body>
<!-- ////////////// -->
<!-- Your HTML here -->
<!-- \\\\\\\\\\\\\\ -->
<!-- Optional Bootstrap JavaScript -->
<script src="location/of/the/bootstrap.js/here"></script>
</body>
</html>
That's all. The page will automatically transition to Dark Mode when the users sets their OS (or Firefox theme) to Dark Mode.
Please note: On browsers that support dark move (via the
preferes-color-scheme
media query) this variant produces exactly the some outcomce, i.e. dark whenpreferes-color-scheme
= dark and light whenpreferes-color-scheme
= ligh. The only visible difference will be on browsers that do not supportpreferes-color-scheme
. (However, thoes browsers may not work with BS5 at all ... see docs: Bootstrap 5 Browsers and devices)
Refer to the Bootstrap 5 Docs for more help.