Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathantneal/convert-colors
Convert Colors converts colors between RGB, HEX, HSL, HWB, LAB, LCH, and more
https://github.com/jonathantneal/convert-colors
Last synced: about 12 hours ago
JSON representation
Convert Colors converts colors between RGB, HEX, HSL, HWB, LAB, LCH, and more
- Host: GitHub
- URL: https://github.com/jonathantneal/convert-colors
- Owner: jonathantneal
- License: cc0-1.0
- Created: 2018-01-21T21:10:52.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-08T03:07:06.000Z (over 1 year ago)
- Last Synced: 2024-11-06T04:51:36.132Z (8 days ago)
- Language: JavaScript
- Homepage: https://jonathantneal.github.io/convert-colors/
- Size: 107 KB
- Stars: 81
- Watchers: 4
- Forks: 7
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Convert Colors [][Convert Colors]
[![NPM Version][npm-img]][npm-url]
[![Linux Build Status][cli-img]][cli-url]
[![Windows Build Status][win-img]][win-url][Convert Colors] converts colors between RGB, HEX, HSL, HWB, LAB, LCH, and more.
```js
import convert from '@csstools/convert-colors';convert.rgb2hsl(100, 100, 100); // [ 0, 0, 100 ]
convert.rgb2hwb(100, 100, 100); // [ 0, 100, 0 ]convert.hsl2rgb(0, 0, 100); // [ 0, 100, 0 ]
convert.hsl2hwb(0, 0, 100); // [ 0, 100, 0 ]convert.hwb2rgb(0, 100, 0); // [ 0, 0, 100 ]
convert.hwb2hsl(0, 100, 0); // [ 0, 0, 100 ]convert.rgb2hue(0, 0, 100); // 240
convert.rgb2contrast([100, 100, 100], [0, 0, 0]); // 21
convert.rgb2ciede2000([100, 100, 100], [0, 0, 0]); // 100
```## Usage
Add [Convert Colors] to your build tool:
```bash
npm install @csstools/convert-colors --save-dev
```## Features
Conversions work by taking arguments that represents a color in one color space
and returning an array of that same color in another color space.[Documentation](https://jonathantneal.github.io/convert-colors/)
[npm-url]: https://www.npmjs.com/package/@csstools/convert-colors
[npm-img]: https://img.shields.io/npm/v/@csstools/convert-colors.svg
[cli-url]: https://travis-ci.org/jonathantneal/convert-colors
[cli-img]: https://img.shields.io/travis/jonathantneal/convert-colors.svg
[win-url]: https://ci.appveyor.com/project/jonathantneal/convert-colors
[win-img]: https://img.shields.io/appveyor/ci/jonathantneal/convert-colors.svg[Convert Colors]: https://github.com/jonathantneal/convert-colors