@eliotttak/color-convert.js
v2.0.0
Published
A simple module to convert between color formats (RGB, HSL, CMYK...)
Readme
Color-convert.js
WARNING: LICENCE CHANGE
I have changed the GPL licence to an LGPL (Lesser General Public Licence) licence, so that the package can be used in both open source and proprietary software.
Practical changes
With the GPL licence, if you wanted to use my package, you had to license your project under the GPL.
With the LGPL licence, you can use my package in a project licensed under Apache, for example.
However, if you wish to modify this package, it must remain under the LGPL licence.
Please note that this only applies to versions 2.0.0 and later; previous versions are still licensed under the GPL.
Translated with DeepL.com (free version)
Introduction
Color-convert.js is a little JavaScript Library, that convert color formats, as RGB, HSL, CMYK and soon many others. It is light, and easy to use.
Availables conversions:
- RGB <==> HSL
- RGB <==> CMYK
- HSL <==> CMYK
- RGB <==> Hexadecimal
Installation
First install in your project
npm install @eliotttak/color-convert.jsAnd then use it in your script
const colorConvertJs = require("@eliotttak/color-convert.js")
console.table(colorConvertJs.rgbToHsl(0, 255, 0))Output :
| (index) | Values | | :-----: | :----: | | h | 120 | | s | 100 | | l | 50 |
Add this line to you HTML
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@eliotttak/color-convert.js"></script>And then you can use it in your scripts:
console.table(rgbToHsl(0, 255, 0))Output :
| (index) | Values | | :-----: | :----: | | h | 120 | | s | 100 | | l | 50 |
API
You can find the JSDoc documentation here : Documentation
Demo
If the site doesn't load, find the demo on CodePen : cdpn.io/pen/full/EaPewYJ
