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

@zokugun/lang.color.cie

v0.3.0

Published

Add CIELAB, CIELUV, CIELCh, CIEXYZ, CIEYxy spaces to Color class

Downloads

7

Readme

@zokugun/lang.color.cie

kaoscript License NPM Version Dependency Status Build Status CircleCI Coverage Status

Provides CIELAB, CIELUV, CIELCh, CIEXYZ, CIEYxy spaces.

Getting Started

With node previously installed:

npm install @zokugun/lang.color.cie

Use it with JavaScript:

require('kaoscript/register');

const { Color, Space } = require('@zokugun/lang.color.cie')();

const c = new Color('ciexyz(11.2933, 11.0002, 12.8373)');

Use it with kaoscript:

import '@zokugun/lang.color.cie'

const c = new Color('ciexyz(11.2933, 11.0002, 12.8373)')

Properties

A color is defined in a color space. If you try to access it into another space, the color will be automatically converted into the new space.

CIEXYZ

  • luma(): Number
  • luma(Number): Color
  • x(): Number
  • x(Number): Color
  • z(): Number
  • z(Number): Color
  • illuminant(): String or Array
  • illuminant(String|Array, String:method): Color
  • observer(): Number
  • observer(Number, String:method): Color

CIEYxy

  • luma(): Number
  • luma(Number): Color
  • x(): Number
  • x(Number): Color
  • y(): Number
  • y(Number): Color

CIELab

  • luma(): Number
  • luma(Number): Color
  • astar(): Number
  • astar(Number): Color
  • bstar(): Number
  • bstar(Number): Color

CIELuv

  • luma(): Number
  • luma(Number): Color
  • ustar(): Number
  • ustar(Number): Color
  • vstar(): Number
  • vstar(Number): Color

CIELCH(ab)

  • luma(): Number
  • luma(Number): Color
  • chroma(): Number
  • chroma(Number): Color
  • hue(): Number
  • hue(Number): Color

CIELCH(uv)

  • luma(): Number
  • luma(Number): Color
  • chroma(): Number
  • chroma(Number): Color
  • hue(): Number
  • hue(Number): Color

Illuminants & Observers

The CIE 1931 2° Standard Observer and the CIE 1964 10° Standard Observer are supported for the standard illuminants.

On a color with non-standard illuminant, changing the observer won't change the coordinates of the color. But changing the illuminant, will always change the coordinates of the color.

SRGB is converted from/to CIEXYZ with the Standard Illuminant D65 and the 2° Standard Observer.

Syntax

const c = new Color('ciexyz(11.2933, 11.0002, 12.8373, D65)')

expect(c.format('cielch(uv)')).to.equal('cielch(uv)(39.5808, 7.4685, 329.1097, D65, 2)')

CIEXYZ

ciexyz(x, luma|Y, z, illuminant?, observer?)

luma: from 0 to 100, up to 4 decimal places
x: from 0 to 127, up to 4 decimal places
z: from 0 to 127, up to 4 decimal places

ciexyz(11.2933, 11.0002, 12.8373)
ciexyz(11.2933, 11.0002, 12.8373, D65, 2)
ciexyza(x, luma|Y, z, alpha, illuminant?, observer?)

ciexyza(11.2933, 11.0002, 12.8373, 0.7)
ciexyza(11.2933, 11.0002, 12.8373, 0.7, D65, 2)

CIEYxy

cieyxy(luma|Y, x, y, illuminant?, observer?)

luma: from 0 to 100, up to 4 decimal places
x: from 0 to 100, up to 4 decimal places
y: from 0 to 100, up to 4 decimal places

cieyxy(11.0002, 32.1464, 31.3121)
cieyxy(11.0002, 32.1464, 31.3121, D65, 2)
cieyxya(luma|Y, x, y, alpha, illuminant?, observer?)

cieyxya(11.0002, 32.1464, 31.3121, 0.7)
cieyxya(11.0002, 32.1464, 31.3121, 0.7, D65, 2)

CIELab

cielab(luma, a, b, illuminant?, observer?)

luma: from 0 to 100, up to 4 decimal places
a: from -128 to 127, up to 4 decimal places
y: from -128 to 127, up to 4 decimal places

cielab(39.5808, 6.2364, -2.2407)
cielab(39.5808, 6.2364, -2.2407, D65, 2)
cielaba(luma, a, b, alpah, illuminant?, observer?)

cielaba(39.5808, 6.2364, -2.2407, 0.7)
cielaba(39.5808, 6.2364, -2.2407, 0.7, D65, 2)

CIELuv

cieluv(luma, u, v, illuminant?, observer?)

luma: from 0 to 100, up to 4 decimal places
u: from -128 to 127, up to 4 decimal places
v: from -128 to 127, up to 4 decimal places

cieluv(39.5808, 6.4091, -3.8343)
cieluv(39.5808, 6.4091, -3.8343, D65, 2)
cieluva(luma, u, v, alpha, illuminant?, observer?)

cieluv(39.5808, 6.4091, -3.8343, 0.7)
cieluv(39.5808, 6.4091, -3.8343, 0.7, D65, 2)

CIELCH(ab)

cielch(ab)(luma, chroma, hue, illuminant?, observer?)

luma: from 0 to 100, up to 4 decimal places
chroma: from 0 to 100, up to 4 decimal places
hue: from 0 to 359.9999, up to 4 decimal places

cielch(ab)(39.5808, 6.6267, 340.237)
cielch(ab)(39.5808, 6.6267, 340.237, D65, 2)
cielcha(ab)(luma, chroma, hue, alpha, illuminant?, observer?)

cielcha(ab)(39.5808, 6.6267, 340.237, 0.7)
cielcha(ab)(39.5808, 6.6267, 340.237, 0.7, D65, 2)

CIELCH(uv)

cielch(uv)(luma, chroma, hue, illuminant?, observer?)

luma: from 0 to 100, up to 4 decimal places
chroma: from 0 to 100, up to 4 decimal places
hue: from 0 to 359.9999, up to 4 decimal places

cielch(uv)(39.5808, 7.4685, 329.1097)
cielch(uv)(39.5808, 7.4685, 329.1097, D65, 2)
cielcha(uv)(luma, chroma, hue, alpha, illuminant?, observer?)

cielcha(uv)(39.5808, 7.4685, 329.1097, 0.7)
cielcha(uv)(39.5808, 7.4685, 329.1097, 0.7, D65, 2)

License

MIT © Baptiste Augrain