https://github.com/michijs/color-converter
A conversion utility for color spaces
https://github.com/michijs/color-converter
color css css4 hex hsl lab lch rgb rgba typescript xyz
Last synced: 8 months ago
JSON representation
A conversion utility for color spaces
- Host: GitHub
- URL: https://github.com/michijs/color-converter
- Owner: michijs
- License: mit
- Created: 2023-04-14T10:40:57.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-04-25T18:25:03.000Z (over 1 year ago)
- Last Synced: 2024-05-01T11:33:41.387Z (over 1 year ago)
- Topics: color, css, css4, hex, hsl, lab, lch, rgb, rgba, typescript, xyz
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@michijs/color-converter
- Size: 453 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Color converter
A conversion utility for color spaces.
![npm][version] [![license][github-license]][github-license-url] ![npm][npm-downloads] ![npm][repo-size]
[](https://github.com/michijs/color-converter/actions/workflows/codeql.yml)
[](https://github.com/michijs/color-converter/actions/workflows/tests.yml)
Based on [CSS color module 4 draft](https://www.w3.org/TR/css-color-4/#color-converter-code) and [Easy RGB documentation](http://www.easyrgb.com/en/math.php)
## Color spaces conversion
Conversion can be made from the following spaces:
- hex ↔ rgba or rgb ↔ xyz ↔ lab ↔ lch
- rgba or rgb ↔ lch (a shorcut for the previous one)
- hex ↔ rgba or rgb ↔ hsl
- hex ↔ rgba or rgb ↔ hsv
## Color spaces support
We offer support for the following spaces:
- [lch (HCL)](https://en.wikipedia.org/wiki/HCL_color_space)
- [lab (CIE LAB)](https://en.wikipedia.org/wiki/CIELAB_color_space)
- [RGB](https://en.wikipedia.org/wiki/RGB_color_model)
- [RGBA](https://en.wikipedia.org/wiki/RGBA_color_model)
- [HEX](https://en.wikipedia.org/wiki/Web_colors) (only with 3, 4, 6 or 8 digits) (FE: #FFF, #FFF0, #FFFFFF, #FFFFFF00)
- [XYZ (CIE 1931)](https://en.wikipedia.org/wiki/CIE_1931_color_space)
- [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV)
- [HSV](https://en.wikipedia.org/wiki/HSL_and_HSV)
## License
- [MIT](https://github.com/michijs/color-converter/blob/master/LICENSE.md)
[repo-size]: https://img.shields.io/github/repo-size/michijs/color-converter
[npm-downloads]: https://img.shields.io/npm/dt/@michijs/color-converter
[version]: https://img.shields.io/npm/v/@michijs/color-converter
[github-license]: https://img.shields.io/github/license/michijs/color-converter
[github-license-url]: https://github.com/michijs/color-converter/blob/master/LICENSE.md