🚀 Including Colornary
A lightweight javascript library for converting, parsing, and manipulating colors.
🚀 Including Colornary
Node
To include with Node, install via npm.
$ npm install --save colornary
Browser
To use in the browser, download the script and add the tag.
🌈 Converting Colors
Color ⇒ RGB
const myRgbColor = ; // => `rgb(255, 255, 255)`
Color ⇒ RGBA
const myRgbaColor = ; // => `rgb(255, 255, 255, 0.5)`
Color ⇒ Hex
const myHexColor = ; // => `#00bfff`
Color ⇒ HSL
const myHslColor = ; // => `hsl(300, 100%, 50%)`
Color ⇒ HSLA
const myHslaColor = ; // => `hsla(300,100%,25%,1)`
🖌 Manipulating Colors
color by a factor
Lighten const myLighterColor = ; // => `rgb(26, 26, 26)`
color by a factor
Darken const myDarkerColor = ; // => `rgb(128, 128, 128)`
color by a factor
Saturate const mySaturatedColor = ; // => `rgb(14, 11, 11)`
color by a factor
Desaturate const myDesaturatedColor = ; // => `hsla(10, 0%, 0%)`
color by a factor
Opacify const myOpacifiedColor = ; // => `rgba(255,255,255,0.7)`
color by a factor
Transparentize const myTransparentizedColor = ; // => `'rgba(255,255,255,0.3)'`
ℹ️ Notes
Color - A color constitues a string or JSON representation of a color, where the color is of a supported type.
Factor - A factor constitues a floating point between 0 and 1 denoting a percentage. Factors default to 0.1 (or 10%).
Supported types
- RGB/A
- HSL/A
- Hex
🎉 Contributing
Pull requests of any kind are welcome; whether it's adding a feature, improving documentation, or fixing a bug. However, there are some standard guidlines to follow when contributing code. Please read the following guide before opening a pull request
Guidelines for opening issues- Check for a similar existing issue.
- Provide steps to reproduce the bug.
- Provide a log/result of the bug.
- Provide documentation for new/improved features.
- Add exhaustive testing for new features.
- Follow linting rules and check build quality.