
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@carry0987/darkmode
Advanced tools
A simple and lightweight JavaScript library for dark mode toggle with localStorage support.
A simple DarkMode switcher, written in TypeScript
pnpm i @carry0987/darkmode
Here is a simple example to use DarkMode
<div class="container py-5">
<div id="app" class="d-flex flex-column justify-content-center align-items-center">
<h1 class="mb-4">DarkMode</h1>
<button id="btn-toggle-dark" class="darkmode-switch">Toggle Dark Mode</button>
</div>
</div>
<script src="dist/darkMode.min.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
let darkmode = new darkModejs.DarkMode({
buttonSelector: '#btn-toggle-dark',
autoDetect: true,
preferSystem: false,
rootElement: document.documentElement,
darkModeStorageKey: 'user-color-scheme',
darkModeMediaQueryKey: '--color-mode',
rootElementDarkModeAttributeName: 'data-user-color-scheme',
onChange: () => {
console.log('onChange');
},
onDark() {
console.log('onDark');
},
onLight() {
console.log('onLight');
}
});
darkmode.onChange = (currentMode) => {
console.log('onChange, current mode: ' + currentMode);
};
});
</script>
import { DarkMode } from '@carry0987/darkmode';
let darkmode = new DarkMode({
//...
});
FAQs
A simple and lightweight JavaScript library for dark mode toggle with localStorage support.
The npm package @carry0987/darkmode receives a total of 5 weekly downloads. As such, @carry0987/darkmode popularity was classified as not popular.
We found that @carry0987/darkmode demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.