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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eye_comfort

v4.1.0

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

25

Readme

Eye Comfort

The Eye Comfort library is designed to improve user experience by reducing eye strain and making long viewing sessions more comfortable. It can be integrated into any JavaScript application to enable night/eye-comfort mode, screen brightness adjustments, and (soon) font-size controls, helping users stay comfortable during extended use.

Under the hood it relies on the CSS filter property, so visual changes are hardware-accelerated and generally safe for performance in modern browsers.

Features

  • Night Mode (clsNightMode) – configurable dim + warm (sepia) effect
  • Brightness (clsBrightness) – global or per-element brightness control
  • Font Size Adjustment – in progress

Function & Options

clsNightMode()

Initializes an eye-comfort / night-light controller for a page or specific element. Returns an object with apply() and reset() methods you can call multiple times.

clsBrightness()

Initializes a brightness controller for a page or specific element. Returns an object with apply() and reset() methods for adjusting and restoring brightness.


Installation

npm install eye_comfort

or via CDN:

<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";

[!NOTE] If you see an "export" error in Next.js, add the package to transpilePackages in next.config.js:

const nextConfig = {
  // ...
  transpilePackages: ["eye_comfort"],
};
export default nextConfig;

Usage

Scroll down for the full list of options.

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

// Whole page (defaults)
nightmode.apply(); // sepia(1), brightness(0.6)
brightness.apply({ value: 0.7 }); // 70% brightness (0.7)

// Specific element
const box = document.querySelector("#element");

nightmode.apply({
element: box,
value: 0.8, // 80% sepia
dim: 0.5, // 50% brightness
});

brightness.apply({
element: box,
value: 0.7, // 70% brightness (use 0.7 instead of 70)
});

// Recommended for React (and similar) to avoid re-creating controllers on every render
const nightmodeMemo = useMemo(clsNightMode, []);
const brightnessMemo = useMemo(clsBrightness, []);

// Reset to original styles
nightmode.reset();
brightness.reset();

// Include additional filters
brightness.apply({
value: 0.8,
include: "blur(10px)",
});

Options

Night Mode (clsNightMode().apply)

Applies a night/comfort mode effect. Returns true when applied successfully.

reset({ element }) restores the original filter value of that element and returns true when it succeeds.


Brightness (clsBrightness().apply)

Adjusts brightness on top of the element’s existing filters. Returns true when applied successfully.

reset({ element }) restores the original filter state of that element and returns true.


Fun Facts

  • It uses the native CSS filter pipeline (brightness, sepia, etc.), so it plays nicely with modern browsers and keeps logic simple.
  • It is written in plain JavaScript, so it is framework-agnostic and can be used in React, Vue, Svelte, vanilla <script> tags, or any other setup you prefer.

This library is inspired by and shares the core logic of the Eye Comfort browser extension, which you can check out here: Eye Comfort - Chrome Web Store