New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chromaticity-color-utilities

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromaticity-color-utilities - npm Package Compare versions

Comparing version 0.8.5-alpha to 0.8.6-alpha

14

dist/ColorType.js

@@ -335,3 +335,8 @@ "use strict";

if (typeof args.method === 'undefined') {
args.method = 'hsl';
if (['hsl', 'hsi', 'hsv', 'hsp'].includes(og)) {
args.method = og;
}
else {
args.method = 'hsl';
}
}

@@ -369,3 +374,8 @@ switch (args.method) {

if (typeof args.method === 'undefined') {
args.method = 'hsl';
if (['hsl', 'hsi', 'hsv', 'hsp'].includes(og)) {
args.method = og;
}
else {
args.method = 'hsl';
}
}

@@ -372,0 +382,0 @@ switch (args.method) {

2

package.json
{
"name": "chromaticity-color-utilities",
"version": "0.8.5-alpha",
"version": "0.8.6-alpha",
"description": "Color utilities for Node.js",

@@ -5,0 +5,0 @@ "main": "dist/main.js",

@@ -13,2 +13,4 @@ # <img src="https://reiniiriarios.github.io/chromaticity-color-utilities/img/chromaticity-icon-01.png" width="26" height="26"> chromaticity-color-utilities

[**📖 Read Full Documentation**](https://reiniiriarios.github.io/chromaticity-color-utilities)
### Example Usage - JavaScript

@@ -63,7 +65,7 @@

## Status
## Documentation
Approaching complete-ish stage... All tests are passing.
Please [read the full documentation](https://reiniiriarios.github.io/chromaticity-color-utilities) for details on each method as well as numerous usage examples.
### Known Issues
## Known Issues

@@ -74,83 +76,2 @@ - YCbCr validates only with a high tolerance. Not sure if floating point issue.

## Documentation
The full docs contain information on each method as well as the mathematics behind them.
[**Full Documentation >** https://reiniiriarios.github.io/chromaticity-color-utilities](https://reiniiriarios.github.io/chromaticity-color-utilities)
## More Example Usage
See [documentation](https://reiniiriarios.github.io/chromaticity-color-utilities) for more details and usage examples.
Any color can be converted to any other, with only a few caveats. Construction `from()`, conversion `to()`, and modification `modify()` methods can be chained.
Object properties can be accessed directly, e.g. `color.r` for the red channel value.
Most colors will retain their arguments as a part of their object properties, such as bitDepth, colorSpace, etc.
```js
const Color = require('chromaticity-color-utilities')
const color1 = Color.from('rgb', [255, 128, 0]).to('hsv')
// hsv { h: 34, s: 100, v: 88, a: 100 }
const color2 = Color.from('hex', 'ff3201').to('rec709rgb', { bitRate: 10 })
// rec709rgb { r: 940, g: 298, b: 67, a: 940, bitDepth: 10, max: 1023 }
const color6 = Color.from('hex', '#ff00ff').to('lab')
// defaulting to sRGB color space with a D65 standard illuminant reference white
// lab { l: 95, a: 142, b: -88 }
const color6 = Color.from('hex', 0xff00ff).to('lab', {
colorSpace: 'AdobeRGB',
referenceWhite: 'D50',
})
// lab { l: 100, a: 150, b: -49 }
const red = Color.from('hsl', [280, 80, 90]).to('rgb').r
// 250
const color7 = Color.from('hsl', [300, 100, 50]).to('ypbpr', {
kb: 0.0722,
kr: 0.2126,
})
// ypbpr { y: 0.2848, pb: 0.3854278939426601, pr: 0.45415290830581667 }
const color3 = Color.from('rgb', [255, 0, 0]).modify('blend', {
with: Color.from('rgb', [0, 255, 0]),
})
// rgb { r: 128, g: 128, b: 0, a: 255, bitDepth: 8, max: 255 }
const color4 = Color.from('rgb', [255, 0, 0]).modify('blend', {
with: Color.from('hex', '00ff00'),
amount: 0.4,
})
// rgb { r: 153, g: 102, b: 0, a: 255, bitDepth: 8, max: 255 }
const color5 = Color.from('hex', 'ee5432')
.modify('blend', {
with: Color.from('rgb', [234, 100, 20, 64 /* alpha */]),
amount: 1 / 3,
})
.to('hsv')
// hsv { h: 15, s: 83, v: 93, a: 75 }
const scheme1 = Color.from('rgb', [200, 180, 0]).scheme('splitComplement')
// [
// rgb { r: 200, g: 180, b: 0, a: 255, bitDepth: 8, max: 255 },
// rgb { r: 0, g: 120, b: 200, a: 255, bitDepth: 8, max: 255 },
// rgb { r: 80, g: 0, b: 200, a: 255, bitDepth: 8, max: 255 }
// ]
const scheme2 = Color.from('hsl', [180, 80, 48]).scheme('tetradic', {
angle: 40,
})
// [
// hsl { h: 180, s: 80, l: 48, a: 100 },
// hsl { h: 220, s: 80, l: 48, a: 100 },
// hsl { h: 40, s: 80, l: 48, a: 100 },
// hsl { h: 0, s: 80, l: 48, a: 100 }
// ]
```
## Compiling from Source

@@ -161,3 +82,3 @@

cd chromaticity-color-utilities
npm i
npm ci
tsc

@@ -164,0 +85,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc