0.2.0 • Published 10 months ago

allc v0.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Allc

A small typescript package for color conversion.

Color Models And Spaces

This library provides these:

  • RGB<"sRGB"> (3xnumber)
    • RGBNumber (3xinteger 0..=255)
    • Hex (3xinteger 0..=255)
    • HSL (3xnumber)
    • HSB (3xnumber)
  • CIE 1931 XYZ

The following color spaces are in development:

  • OKLAB
  • OKLCH
  • Display P3
  • Adobe RGB

More color spaces might be added in the future.

How To Use This Library

You can create colors by using the literal syntax {r: ..., g: ..., b: ...}.

Converting between colors is straight forward. It uses the scheme to{TARGET}From{SOURCE} where {TARGET} and {SOURCE} are color spaces.

This library does not have a fully featured conversion matrix (meaning, you cannot convert every type in every other directly). Instead, do the following:

  • HexRGBNumberRGB
  • HSLRGB
  • HSVRGB

From there you can convert to CIE1931XYZ and from there you can convert to any other type.

Guarantees

  • This package does not throw.
  • Only types and functions are used.
  • This package is side effect free (only pay for what you use).

The implementation decisions section is gone; a replacement article will be published on https://trombecher.github.io/.

0.1.0

10 months ago

0.2.0

10 months ago

0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago