
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
svelte-theme-switcher
Advanced tools

A happy little svelte theme switcher to brighten or maybe darken your day 🌞.
App.svelte
<script>
import ThemeSwitcher from "svelte-theme-switcher";
</script>
<style>
:global(body) {
background: var(--background);
color: var(--text);
transition: 0.6s;
}
:global(.theme-light) {
--background: rgb(250, 252, 240);
--text: #222;
}
:global(.theme-dark) {
--background: #222;
--text: #fff;
}
</style>
<ThemeSwitcher />
npm i svelte-theme-switcher
yarn add svelte-theme-switcher
| Property | default | type | notes |
|---|---|---|---|
| height: | 30px | string | must be a px value |
| width: | 60px | string | |
| transition | 0.6s | string | |
| background | { light: #ecf0f1, dark: #333 } | object |
<ThemeSwitcher
options={{
height: "30px",
width: "60px",
transition: "0.6s",
background: {
light: "#ecf0f1",
dark: "#333",
},
}}
/>
<script>
import { theme } from "svelte-theme-switcher";
</script>
<h1>{$theme}</h1>
In the head of your document add:
<script src="https://unpkg.com/svelte-theme-switcher@0.0.11/dist/wc/index.js" />
<style>
body {
background: var(--background);
color: var(--text);
transition: 0.6s;
}
.theme-light {
--background: rgb(250, 252, 240);
--text: #222;
}
.theme-dark {
--background: #222;
--text: #fff;
}
</style>
this ensure's there is no inital flicker
You can now add the web component to switch between themes.
<theme-switcher></theme-switcher>
FAQs

We found that svelte-theme-switcher demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.