https://github.com/anireact/hsl
Minimal and fast HSLᵤᵥ implementation.
https://github.com/anireact/hsl
color-space hsluv
Last synced: 4 months ago
JSON representation
Minimal and fast HSLᵤᵥ implementation.
- Host: GitHub
- URL: https://github.com/anireact/hsl
- Owner: anireact
- License: mit
- Created: 2019-10-18T17:34:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T01:08:41.000Z (over 3 years ago)
- Last Synced: 2025-09-20T00:34:28.606Z (9 months ago)
- Topics: color-space, hsluv
- Language: WebAssembly
- Homepage:
- Size: 633 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @ripreact/hsl
> Minimal (≈670 bytes minigzip) and fast (up to 60% faster than original)
> partial [HSLᵤᵥ](http://hsluv.org) implementation with TypeScript support.
```bash
yarn add @ripreact/hsl
```
## Usage
```javascript
// ES module
import { hsl, hsla } from '@ripreact/hsl';
console.log(hsl(0, 100, 50)); // → `'#ea0064'`
console.log(hsla(0, 100, 50, 0.5)); // → `'#ea006480'`
```
```javascript
// CommonJS
const { hsl, hsla } = require('@ripreact/hsl/cjs');
console.log(hsl(0, 100, 50));
console.log(hsla(0, 100, 50, 0.5));
```
> **NB:** By default `@ripreact/hsl` exports `*.mjs` module. If for some reasons
> you need ES module with `*.js` extension, use `@ripreact/hsl/esm` entry point.
> Also, you may specify `@ripreact/hsl/mjs` explicitly to import the same module
> as using default entry point.
## NAPI addon
```javascript
// Or `@ripreact/hsl/native/cjs` for CommonJS ↓
import { hsl, hsla } from '@ripreact/hsl/native/mjs';
console.log(hsl(0, 100, 50));
console.log(hsla(0, 100, 50, 0.5));
```
## License
MIT