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

d3-jnd

v0.1.3

Published

Just-noticeable differences for colors in CEILAB color space

Downloads

29

Readme

d3-jnd

To access the latest version of d3-jnd, grab it on unpkg. Note that d3-jnd depends on d3-color.

This module extends D3 to support color just-noticeable difference (JND) research by Maureen Stone, Danielle Albers Szafir, and Vidya Setlur (link).

@inproceedings{stone-2014-emc,
  title={An engineering model for color difference as a function of size},
  author={Stone, Maureen and Szafir, Danielle Albers and Setlur, Vidya},
  booktitle={Color and Imaging Conference},
  volume={2014},
  number={2014},
  pages={253--258},
  year={2014},
  organization={Society for Imaging Science and Technology}
}

d3-jnd has two functions: d3.noticeablyDifferent() and d3.jndInterval. Both take size and percent arguments, which alter how conservative JND estimations are.

Note that the recommendations that are provided by this library are predicted JND intervals, and should be treated as guidelines rather than absolute truth. See the d3-jnd website for more information about how to manipulate d3-jnd function arguments appropriately.

var c1 = d3.lab('black'),
    c2 = d3.rgb('white'),
    legible = d3.noticeablyDifferent(c1, c2); // true

var intervals = d3.jndInterval(0.5, 0.3);

var strictlyLegible = d3.noticeablyDifferent(c1, c2, 0.95, 0.1);

Installation

After downloading the repo, run npm install, which will install any dependencies. You can optionally install from npm opposed to cloning directly from GitHub. Make sure to load d3-cam02 after d3-color.

Dependencies: d3-color

API Reference

# d3.noticeablyDifferent(color, color[, percent, size]) <>

A function that returns true/false based on whether the two provided colors are noticeably different. Percent controls the percent of audience that will likely see a difference between the two colors quickly and easily. Size refers to the estimated visual angle of color area (smaller areas are harder to discriminate).

# d3.jndInterval(percent, size) <>

As d3.noticeablyDifferent except it returns the intervals along L*, a*, and b* channels of CIELAB that produce differences equal to "1 JND".