Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)
@ripreact/hsl
Minimal (≈670 bytes minigzip) and fast (up to 60% faster than original) partial HSLᵤᵥ implementation with TypeScript support.
yarn add @ripreact/hsl
Usage
// ES module
import { hsl, hsla } from '@ripreact/hsl';
console.log(hsl(0, 100, 50)); // → `'#ea0064'`
console.log(hsla(0, 100, 50, 0.5)); // → `'#ea006480'`
// 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/hslexports*.mjsmodule. If for some reasons you need ES module with*.jsextension, use@ripreact/hsl/esmentry point. Also, you may specify@ripreact/hsl/mjsexplicitly to import the same module as using default entry point.
NAPI addon
// 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