npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eye_comfort

v3.1.2

Published

The 'Eye Comfort' Library is designed to improve user experience by providing functionalities aimed at reducing eye strain and promoting comfortable viewing. This hook can be easily integrated into any JS application to enable features such as eye comfort

Downloads

76

Readme

Eye Comfort

The 'Eye Comfort' Library is designed to improve user experience by providing functionalities aimed at reducing eye strain and promoting comfortable viewing. It can be easily integrated into any JS application to enable features such as eye comfort mode, font size adjustments, and screen brightness control. By incorporating this library, developers can enhance the accessibility and usability of their applications, ensuring that users can comfortably interact with the interface for extended periods without experiencing discomfort or fatigue.

Features

  • Night Mode (clsNightMode)
  • Brightness (clsBrightness)
  • Font Size Adjustment [in progress]

Function & Options

clsNightMode()

Use this to initalize an eye comfort/night light mode for a page/element. It returns a function that can be used to create the effect.

clsBrightness()

Use this, to initalize brightness functionality, to adjust the brightness of a page/element. It returns a function that can be used to create the effect.

Installation

npm install eye_comfort
<!-- or -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.min.js"></script>

Initialize

import { clsNightMode, clsBrightness } from "eye_comfort";
// or
import { clsNightMode } from "eye_comfort";
// or
import { clsBrightness } from "eye_comfort";
// or
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.min.js"></script>

[!NOTE] In case you get the "export error" while using it with NextJS try adding this rule in the next.config

{ ... transpilePackages: ['eye_comfort'], ...}

Usage

Scroll Down for the complete list of options, to consumed by returned functions

const nightmode = clsNightMode();
const brightness = clsBrightness();

// whole page
nightmode();
brightness({value: .7}); // you can also use percentage for eg. 70%

// specific element
nightmode({ element: document.querySelector("#element") });
brightness({ element: document.querySelector("#element"), value: .7 }); // you can also use percentage for eg. 70%

// the best way, to use in react or other lib. that reinitiates local variable on state change, is to use it with a hook that can memoize/cache the output
const nightmode = useMemo(clsNightMode, []);
const brightness = useMemo(clsBrightness, []);

// reset to default when disabled
nightmode({ original: "brightness(.4)" });

// include another filter as well
brightness({ include: "blur(10px)" });

Options

Night Mode

This function is used to toggle night mode effect on a page, it returns a boolean (enabled or not).

Brightness

This function is used to adjust brightness of a page, it returns nothing.

Fun Facts

  • It uses CSS filtes behind the hood so, You don't have to worry about the site's performance or ranking issues
  • It is created using plain JavaScript, thus not bound by any framework rules. This gives you the freedom to use it anywhere and in any way you like, whether inside other hooks or in a script tag. :wink:

You can play with these features, applied to our website at https://www.autonomousweb.org/