Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
darky
Advanced tools
Readme
At the beginning install the library in Your project via npm or Yarn:
$ npm install darky
$ yarn add darky
Connect using script tag in HTML:
<script src="/directory/to/library/folder/darky.js"></script>
Or CommonJS/ES6 import:
const Darky = require('darky'); // CommonJS
import Darky from 'darky'; // ES6
Next use library with:
• Vanilla JavaScript e.g:
const darky = new Darky({
// options...
});
• Switch between light and dark mode:
darky.toggle();
• Switch mode automatically (based on time, location and sun position):
darky.auto();
• Reset localStorage data:
darky.reset();
Name | Type | Default | Description | Available options |
---|---|---|---|---|
lightClass | string | | Class added to body when light mode is active | Name of the class |
darkClass | string | dark | Class added to body when dark mode is active | Name of the class |
cache | boolean | true | cache location coordinates in local storage for one day | true (enable), false (disable) |
cacheClear | boolean | true | clear location coordinates in local storage everyday at midnight | true (enable), false (disable) |
auto | boolean | true | enable smart switch on script init | true (enable), false (disable) |
onAuto | function | null | callback on smart switch | () => { // code } |
onLight | function | null | callback when dark mode is disabled | () => { // code } |
onDark | function | null | callback when dark mode is enabled | () => { // code } |
onToggle | function | null | callback on dark/light mode toggle | () => { // code } |
onCacheClear | function | null | callback when location coordinates and midnight time in local storage cleared | () => { // code } |
onReset | function | null | callback on localStorage reset | () => { // code } |
smartDark
event will output sun position times and user geolocation latitude & longitude
This project is licensed under the MIT License © 2018-present Jakub Biesiada
FAQs
Smart dark mode switcher (based on location and time)
The npm package darky receives a total of 14 weekly downloads. As such, darky popularity was classified as not popular.
We found that darky 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.