Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
astro-color-mode
Advanced tools
Provides system or user-defined color scheme preference, with a toggle mechanism. Settings are persisted, component is progressively enhanced and flash of unstyled content avoided. Also, it will provide an easier way to target theme with CSS / SCSS / JS.
Provides system or user-defined color scheme preference, with a toggle mechanism.
Settings are persisted, component is progressively enhanced and flash of mis-styled content avoided.
Also, this provides an easier way to target theme with CSS selector / SCSS mixins / JS DOM selector.
data-color-mode="dark|light"
attribute on root documentpnpm i astro-color-mode
---
import { ColorMode } from 'astro-color-mode';
// ...
---
<!-- ... -->
<head>
<!-- Place component inside `HEAD` tag -->
<ColorMode />
<!-- ... -->
</head>
Use data-color-mode-switch
where you want to toggle theme setting,
on an any element, somewhere inside BODY
tag:
<!-- ... -->
<body>
<!-- ... -->
<button data-color-mode-switch>Toggle COLOR MODE 💡</button>
<!-- ... -->
</body>
<html data-color-mode="light|dark">
<!-- ... -->
</html>
SCSS mixins registration in astro.config.mjs
:
export default defineConfig({
// ...
vite: {
css: {
preprocessorOptions: {
scss: {
additionalData: `
@use "astro-color-mode/use-color-mode.scss" as *;
`,
},
},
},
},
});
Then, use it like this in your stylesheets:
span {
@include color-mode(light) {
color: black;
background-color: white;
// ...
}
@include color-mode(dark) {
color: white;
background-color: black;
// ...
}
}
@media
query support for SCSS mixinsFAQs
Provides system or user-defined color scheme preference, with a toggle mechanism. Settings are persisted, component is progressively enhanced and flash of unstyled content avoided. Also, it will provide an easier way to target theme with CSS / SCSS / JS.
The npm package astro-color-mode receives a total of 3 weekly downloads. As such, astro-color-mode popularity was classified as not popular.
We found that astro-color-mode 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.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.