Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@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.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.