Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baianat/color-fns
🎨 Modern JavaScript color utilities library
https://github.com/baianat/color-fns
color color-fns fns hsl rgb
Last synced: 5 days ago
JSON representation
🎨 Modern JavaScript color utilities library
- Host: GitHub
- URL: https://github.com/baianat/color-fns
- Owner: baianat
- License: mit
- Created: 2018-03-12T10:25:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T18:34:10.000Z (almost 2 years ago)
- Last Synced: 2024-10-05T17:34:03.322Z (about 1 month ago)
- Topics: color, color-fns, fns, hsl, rgb
- Language: TypeScript
- Homepage:
- Size: 1.74 MB
- Stars: 80
- Watchers: 2
- Forks: 4
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/baianat/color-fns.svg?branch=master)](https://travis-ci.org/baianat/color-fns)
[![codecov](https://codecov.io/gh/baianat/color-fns/branch/master/graph/badge.svg)](https://codecov.io/gh/baianat/color-fns)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a4d7bc3726514688b7186cce0852ebc4)](https://www.codacy.com/app/logaretm1/color-fns?utm_source=github.com&utm_medium=referral&utm_content=baianat/color-fns&utm_campaign=Badge_Grade)
Modern and Modular JavaScript color utility library. [inspired by date-fns](https://date-fns.org/).
## Features
- Written in TypeScript. 😎
- Lightweight. 💸
- Modular and Tree-shakable.🌳
- Multi-Color Model Support. 🎨
- CSS compatible output. 💨## Installation
```bash
# yarn
yarn add color-fns# npm
npm i color-fns
```OR
```html
```
### Usage
```js
// ES2015 (ES6)
import { toRgb } from 'color-fns';console.log(toRgb('#fff'));
// CommonJS
const { toRgb } = require('color-fns');
console.log(toRgb('#fff'));// UMD (Script Tag)
console.log(ColorFns.toRgb('#fff'));
```### Available Functions
#### Parsing
- parseCmyk
- parseHex
- parseHsl
- parseHsv
- parseRgb#### Conversion
- cmykToRgb
- hexToRgb
- hslToRgb
- hsvToRgb
- rgbToCmyk
- rgbToHex
- rgbToHsl
- rgbToHsv
- toCmyk
- toHex
- toHsl
- toHsv
- toRgb#### Operations
- mix
#### Format and Display
- expandHexShorthand
- formatCmyk
- formatHex
- formatHsl
- formatHsv
- formatRgb#### Validation
- isValidCmyk
- isValidHex
- isValidHsl
- isValidHsv
- isValidRgb#### Querying
- whichModel
- constrastInfo
- isDark
- hexFromName
- hexToName#### Calculations
- relativeLuminance
### Contribution
Contributions are welcomed, however make sure you read the [contribution guide](.github/CONTRIBUTING.md) and the [code of conduct](.github/CONDUCT.md) before making any pull requests.
### License
MIT