
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
bootstrap-dark-theme
Advanced tools
Adds a Bootstrap 5 light/dark theme toggle button in the navbar using Bootstrap color mode
Install via npm:
npm install bootstrap-dark-theme@1
Use locally:
<script src="./node_modules/bootstrap-dark-theme/dist/dark-theme.js"></script>
Use via CDN:
<script src="https://cdn.jsdelivr.net/npm/bootstrap-dark-theme@1"></script>
Add a <div class="bootstrap-dark-theme"></div> inside your navbar. The dark theme toggle replaces it.
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<div class="bootstrap-dark-theme"></div>
</div>
</nav>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap-dark-theme@1/dist/dark-theme.js" type="module"></script>
You can replace <div class="bootstrap-theme"></div> with your toggle. For example:
<div class="position-relative" role="group" aria-label="Toggle dark mode" title="Toggle Dark Mode">
<button class="dark-theme-toggle btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Open navigation menu">
<i class="bi bi-circle-half"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><button class="dropdown-item" data-bs-theme-value="light"><i class="me-2 bi sun-fill"></i> Light</button></li>
<li><button class="dropdown-item" data-bs-theme-value="dark"><i class="me-2 bi bi-moon-stars-fill"> Dark</button></li>
<li><button class="dropdown-item" data-bs-theme-value="auto"><i class="me-2 bi bi-circle-half"> Auto</button></li>
</ul>
</div>
Make sure you have:
dark-theme-toggle that serves as the main toggle buttondata-bs-theme-value with values:
light: Forces the light theme regardless of system preferencedark: Forces the dark theme regardless of system preferenceauto: Uses the system preference (light or dark) based on the user's OS settingsauto.How it works:
data-bs-theme-value attributeauto if invalid)data-bs-theme attribute on the root elementgit clone https://github.com/sanand0/bootstrap-dark-theme.git
cd bootstrap-dark-theme
npm install
npm run lint && npm run build && npm test
npm publish
git commit . -m"$COMMIT_MSG"; git tag $VERSION; git push --follow-tags
https://cdn.jsdelivr.net/npm/bootstrap-dark-theme@1<div class="bootstrap-theme"></div>FAQs
Bootstrap 5 dark theme toggle button
We found that bootstrap-dark-theme demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.