On this link: https://getbootstrap.com/docs/5.3/components/navbar/
If you scroll down to "Color schemes"
<nav class="navbar bg-dark" data-bs-theme="dark">
<!-- Navbar content -->
</nav>
If you scroll down to "External content"
<nav class="navbar navbar-dark bg-dark">
As they write in the paragraph above code you posted:
New dark navbars in v5.3.0 — We’ve deprecated .navbar-dark in favor of the new data-bs-theme="dark". Add data-bs-theme="dark" to the .navbar to enable a component-specific color mode. Learn more about our color modes.
Also data-bs-theme
is for using different color schemes. Not just light or dark, you can define your own. See more in Color modes documentation.