Huebris
Tiny helpers for HSL colors
Features
- Brightness / Saturation calibration across hues
- Find intermediate hues (good for gradients)
- Works on both server and client
Usage
Installation
Guided tutorial on path.cafe (coming soon)
Via NPM:
npm install huebris
Script tag (via unpkg):
<!-- Available as global variable huebris -->
Browser Module (via snowpack):
// OR import huebris from 'https://cdn.skypack.dev/huebris';
API
mix(hue1,hue2,ratio)
Returns the mixed hue between hue1
and hue2
at a desired ratio, where ratio = 0
results in hue1, and ratio = 1
results in hue2
. Will correctly wrap across 0/360 (both 0 and 360 are red in HSL)
console // "150" console // "40" console // "150"
lumCorrection(hue)
Returns a value [0,1] that represents the corrective coefficient to equalize the brightness based on the hue. WIP - formula bound to change (!)
console // "0.8" (red) console // "0.6" (green) console // "1.0" (blue)
hsl2(h,s,l)
Returns a CSS string with corrected saturation and luminance values
console // hsl(120, 80%, 40%)
Details
HSL based themes
Coming soon
Luminance Calculations
Coming soon
Development
Contributing Guidelines
Commands
Guided process to commit changes and/or submit a pull request
npm run save
Roadmap
- Accessibility contrast guarantees with automated browser testing
- Alternate formulations
- Webapp color generator
- Examples & Tutorials
Acknowledgements
License
MIT © Marshall Brandt