
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@noeg/usetheme
Advanced tools
A React hook for implementing theme management with support for light, dark, and system themes.
npm install @noeg/usetheme
# or
yarn add @noeg/usetheme
# or
pnpm add @noeg/usetheme
import { ThemeProvider, useTheme } from '@noeg/usetheme'
// Wrap your app with ThemeProvider
function App() {
return (
<ThemeProvider
defaultTheme="system" // Optional: 'light' | 'dark' | 'system'
storageKey="my-app-theme" // Optional: custom storage key
>
<YourApp />
</ThemeProvider>
)
}
// Use the hook in your components
function ThemeToggle() {
const { theme, systemTheme, setTheme } = useTheme()
return (
<div>
<p>Current theme: {theme}</p>
<p>System theme: {systemTheme}</p>
<button onClick={() => setTheme('light')}>Light</button>
<button onClick={() => setTheme('dark')}>Dark</button>
<button onClick={() => setTheme('system')}>System</button>
</div>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
defaultTheme | 'light' | 'dark' | 'system' | 'system' | Default theme to use |
storageKey | string | 'vite-ui-theme' | Local storage key for persisting the theme |
children | React.ReactNode | - | Child components |
| Property | Type | Description |
|---|---|---|
theme | 'light' | 'dark' | 'system' | Current theme setting |
systemTheme | 'light' | 'dark' | Current system theme (when theme='system') |
setTheme | (theme: Theme) => void | Function to update the theme |
The hook automatically:
light or dark) to the document rootThe theme provider adds either light or dark class to your document's root element. You can style your application accordingly:
:root.light {
--background: #ffffff;
--text: #000000;
}
:root.dark {
--background: #000000;
--text: #ffffff;
}
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
React hook and provider for application theming
We found that @noeg/usetheme 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.